summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qaction.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-07-10 11:39:17 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-07-13 10:18:40 +0000
commitb693900da5748277e34b99e37fd51f18861e03c4 (patch)
tree38bf129a813bdb4bc19c615fbbb84e636937b509 /src/widgets/kernel/qaction.cpp
parent554d54b432bbbe8531b7bf4d8fc519280e679597 (diff)
Polish the widgets/mainwindows/application example.
- Introduce Qt 5 signals & slot syntax - Use QCommandLineParser to obtain file arguments - Merge MainWindow::createMenus()/createQToolBars() into MainWindow::createActions(), removing the need to store the actions as member variables. Use QMenu::addAction() for brevity. - Use QIcon::fromTheme() to obtain system icons and use resource icons as fallback. - Rewrite settings code to use QWidget::saveGeometry(), Widget::restoreGeometry() since saving size and position does not work well with multiple screens. Query the available size when determining the initial size instead of using hard-coded values for High-DPI screens. - Fix minor issues in code, use multi-argument version of QString::arg(), QDir::toNativeSeparators() to present file paths to the user. - Fix snippet references accordingly. Change-Id: I1bc49a8913aa6d669e0e666f04be3f1f42eaba10 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
Diffstat (limited to 'src/widgets/kernel/qaction.cpp')
-rw-r--r--src/widgets/kernel/qaction.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index 9fbcf28aad..255ffbd258 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -228,8 +228,9 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
\snippet mainwindows/application/mainwindow.cpp 19
\codeline
- \snippet mainwindows/application/mainwindow.cpp 28
- \snippet mainwindows/application/mainwindow.cpp 31
+ \code
+ fileMenu->addAction(openAct);
+ \endcode
We recommend that actions are created as children of the window
they are used in. In most cases actions will be children of