summaryrefslogtreecommitdiffstats
path: root/examples/widgets/widgets/tablet/mainwindow.h
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@theqtcompany.com>2015-07-31 11:57:48 +0200
committerShawn Rutledge <shawn.rutledge@theqtcompany.com>2016-01-28 19:17:08 +0000
commite6de387ea0d2bf479caf7216f206ff35241faa3b (patch)
tree70fb2efc79c994ac1c36bda407a33d68b40b80aa /examples/widgets/widgets/tablet/mainwindow.h
parent910f719bd111813f37278b67d07f9d12cb03a4ff (diff)
Polish the Tablet example
- Introduce Qt 5 signal-slot connection syntax. - Merge MainWindow::createMenus()/createActions() into MainWindow::createMenus(), removing the need to store the actions as member variables. Use QMenu::addAction() for brevity. - For actions in QActionGroups, carry the Valuator enum in QAction::data so that the slot to handle the selection does not need to compare the QAction pointer itself. - Use a non-modal QColorDialog, so that the user can change colors more easily while drawing. - Choose saner shortcut keys: control-Q should not override the default usage for quitting the application, and using shortcuts for About dialogs is anyway dubious. - Improve the example documentation. Change-Id: I57aaf5f5b885c13a953482dbcc41275dd3d6bff4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Topi Reiniƶ <topi.reinio@theqtcompany.com>
Diffstat (limited to 'examples/widgets/widgets/tablet/mainwindow.h')
-rw-r--r--examples/widgets/widgets/tablet/mainwindow.h58
1 files changed, 10 insertions, 48 deletions
diff --git a/examples/widgets/widgets/tablet/mainwindow.h b/examples/widgets/widgets/tablet/mainwindow.h
index c6ac2e6026..23d587baac 100644
--- a/examples/widgets/widgets/tablet/mainwindow.h
+++ b/examples/widgets/widgets/tablet/mainwindow.h
@@ -44,10 +44,7 @@
#include <QMainWindow>
QT_BEGIN_NAMESPACE
-class QAction;
-class QActionGroup;
-class QMenu;
-class QStatusBar;
+class QColorDialog;
QT_END_NAMESPACE
class TabletCanvas;
@@ -60,54 +57,19 @@ public:
MainWindow(TabletCanvas *canvas);
private slots:
- void brushColorAct();
- void alphaActionTriggered(QAction *action);
- void lineWidthActionTriggered(QAction *action);
- void saturationActionTriggered(QAction *action);
- void saveAct();
- void loadAct();
- void aboutAct();
+ void setBrushColor();
+ void setAlphaValuator(QAction *action);
+ void setLineWidthValuator(QAction *action);
+ void setSaturationValuator(QAction *action);
+ void save();
+ void load();
+ void about();
private:
- void createActions();
void createMenus();
- TabletCanvas *myCanvas;
-
- QAction *brushColorAction;
- QActionGroup *brushActionGroup;
-
- QActionGroup *alphaChannelGroup;
- QAction *alphaChannelPressureAction;
- QAction *alphaChannelTangentialPressureAction;
- QAction *alphaChannelTiltAction;
- QAction *noAlphaChannelAction;
-
- QActionGroup *colorSaturationGroup;
- QAction *colorSaturationVTiltAction;
- QAction *colorSaturationHTiltAction;
- QAction *colorSaturationPressureAction;
- QAction *noColorSaturationAction;
-
- QActionGroup *lineWidthGroup;
- QAction *lineWidthPressureAction;
- QAction *lineWidthTiltAction;
- QAction *lineWidthFixedAction;
-
- QAction *exitAction;
- QAction *saveAction;
- QAction *loadAction;
-
- QAction *aboutAction;
- QAction *aboutQtAction;
-
- QMenu *fileMenu;
- QMenu *brushMenu;
- QMenu *tabletMenu;
- QMenu *helpMenu;
- QMenu *colorSaturationMenu;
- QMenu *lineWidthMenu;
- QMenu *alphaChannelMenu;
+ TabletCanvas *m_canvas;
+ QColorDialog *m_colorDialog;
};
//! [0]