summaryrefslogtreecommitdiffstats
path: root/examples/widgets/mainwindows/mainwindow/toolbar.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-07-17 10:41:44 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-07-17 14:15:11 +0000
commit2fe56e37ede40dc703a9c3c8eb240b80c9c00757 (patch)
treeaca858f6e085f23b254df4a7a08c0c10e9805f34 /examples/widgets/mainwindows/mainwindow/toolbar.h
parent7f77d4fcd5534ec0973654e37c8ef189dce35778 (diff)
Polish the examples/widgets/mainwindows example.
- Introduce Qt 5 signals & slot syntax. - Replace QSignalMapper used for the corner/area actions by a by a functor. - Improve command line parsing. - Reorder class declarations. - Remove commented-out code. - Use QDialogButtonBox in dialogs. - Fix minor issues in code, use multi-argument version of QString::arg(), QDir::toNativeSeparators() to present file paths to the user, static method invocations. Change-Id: I865c56639c74135b59740797e9a9dfbfca2e72b6 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'examples/widgets/mainwindows/mainwindow/toolbar.h')
-rw-r--r--examples/widgets/mainwindows/mainwindow/toolbar.h66
1 files changed, 29 insertions, 37 deletions
diff --git a/examples/widgets/mainwindows/mainwindow/toolbar.h b/examples/widgets/mainwindows/mainwindow/toolbar.h
index b1674a2034..2629d9d7a7 100644
--- a/examples/widgets/mainwindows/mainwindow/toolbar.h
+++ b/examples/widgets/mainwindows/mainwindow/toolbar.h
@@ -40,49 +40,15 @@ QT_FORWARD_DECLARE_CLASS(QAction)
QT_FORWARD_DECLARE_CLASS(QActionGroup)
QT_FORWARD_DECLARE_CLASS(QMenu)
QT_FORWARD_DECLARE_CLASS(QSpinBox)
-QT_FORWARD_DECLARE_CLASS(QLabel)
class ToolBar : public QToolBar
{
Q_OBJECT
- QSpinBox *spinbox;
- QAction *spinboxAction;
-
- QAction *orderAction;
- QAction *randomizeAction;
- QAction *addSpinBoxAction;
- QAction *removeSpinBoxAction;
-
- QAction *movableAction;
-
- QActionGroup *allowedAreasActions;
- QAction *allowLeftAction;
- QAction *allowRightAction;
- QAction *allowTopAction;
- QAction *allowBottomAction;
-
- QActionGroup *areaActions;
- QAction *leftAction;
- QAction *rightAction;
- QAction *topAction;
- QAction *bottomAction;
-
- QAction *toolBarBreakAction;
-
public:
- ToolBar(const QString &title, QWidget *parent);
-
- QMenu *menu;
+ explicit ToolBar(const QString &title, QWidget *parent);
-protected:
- void enterEvent(QEvent*) Q_DECL_OVERRIDE;
- void leaveEvent(QEvent*) Q_DECL_OVERRIDE;
-
-private:
- void allow(Qt::ToolBarArea area, bool allow);
- void place(Qt::ToolBarArea area, bool place);
- QLabel *tip;
+ QMenu *toolbarMenu() const { return menu; }
private slots:
void order();
@@ -105,6 +71,32 @@ private slots:
void updateMenu();
void insertToolBarBreak();
+private:
+ void allow(Qt::ToolBarArea area, bool allow);
+ void place(Qt::ToolBarArea area, bool place);
+
+ QSpinBox *spinbox;
+ QAction *spinboxAction;
+
+ QMenu *menu;
+ QAction *orderAction;
+ QAction *randomizeAction;
+ QAction *addSpinBoxAction;
+ QAction *removeSpinBoxAction;
+
+ QAction *movableAction;
+
+ QActionGroup *allowedAreasActions;
+ QAction *allowLeftAction;
+ QAction *allowRightAction;
+ QAction *allowTopAction;
+ QAction *allowBottomAction;
+
+ QActionGroup *areaActions;
+ QAction *leftAction;
+ QAction *rightAction;
+ QAction *topAction;
+ QAction *bottomAction;
};
-#endif
+#endif // TOOLBAR_H