DynamicPanels Example

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

//#define OLD_GLWidget

#include <QPen>
#include <QMenu>
#include <QMdiArea>
#ifdef OLD_GLWidget
#include <QGLWidget>
#endif
#include <QOpenGLWidget>

#include "DemoDockWindow.h"

/* MainWindow */
class MainWindow : public DemoDockWindow
{
    Q_OBJECT
public:
    explicit MainWindow();
    virtual ~MainWindow();
private:
    void createActions();
    void createMenu();
    void createToolBar();
    void createStatusBar();
    QWidget* createMdiChild();
protected Q_SLOTS:
    void slot_createForm();
    void slot_createTree();
    void slot_createTable();
    void slot_createOpenGL();
    void slot_createThreeRows();
    void slot_createThreeColumns();
    void slot_createThreeTabs();
    void panelRequested(DockPanelRequestedArgs* args);
protected:
    DockWidgetPanel* createFormPanel();
    DockWidgetPanel* createTreePanel();
    DockWidgetPanel* createTablePanel();
    DockWidgetPanel* createOpenGLPanel();
private:
    QMdiArea* m_mdiArea;

    QMenu* m_fileMenu;
    QMenu* m_editMenu;
    QMenu* m_viewMenu;
    QMenu* m_helpMenu;

    DockToolBar* m_fileToolBar;

    QAction* m_fileNewAction;
    QAction* m_fileOpenAction;
    QAction* m_fileSaveAction;
    QAction* m_filePrintAction;
    QAction* m_editCutAction;
    QAction* m_editCopyAction;
    QAction* m_editUndoAction;
    QAction* m_editRedoAction;

    QAction* m_createFormAction;
    QAction* m_createTreeAction;
    QAction* m_createTableAction;
    QAction* m_createOpenGLAction;

    QAction* m_createThreeRowsAction;
    QAction* m_createThreeColumnsAction;
    QAction* m_createThreeTabsAction;

    int m_formCount;
    int m_openGLFormCount;
    int m_treeCount;
    int m_tableCount;
private:
    Q_DISABLE_COPY(MainWindow);
};

#ifdef OLD_GLWidget
class GLWidget : public QGLWidget
#else
class GLWidget : public QOpenGLWidget
#endif
{
    Q_OBJECT
public:
    class Helper
    {
    public:
        Helper(int num);
    public:
        void paint(QPainter* painter, QPaintEvent* event, int elapsed);
    private:
        QBrush m_background;
        QBrush m_circleBrush;
        QFont m_textFont;
        QPen m_circlePen;
        QPen m_textPen;
        int m_number;
    };
public:
    GLWidget(int num, QWidget* parent = Q_NULL);
    virtual ~GLWidget();
public Q_SLOTS:
    void animate();
protected:
    virtual void paintEvent(QPaintEvent* event) override;
private:
    Helper* m_helper;
    int m_elapsed;
};

#endif