summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-07-15 13:29:31 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-07-17 14:14:56 +0000
commitfdb8ef6507a556589425e7a109172952c03bfd22 (patch)
tree94ed3819df813c5d27971dc6e6bd4271f9cddb48 /src/widgets
parent696ea2fff15cf0f8c1016353cfcb93d1f368129c (diff)
Polish the widgets/mainwindows/sdi example.
- Introduce Qt 5 signals & slot syntax. - Use QCommandLineParser to obtain file arguments, factor out positioning into tile() function to be able to use it from command line and open/new slots. - 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 and and static method invocation. - Fix snippet references accordingly. Change-Id: I3ea0372bc7ff82247192f54620289352fb68d60f Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc b/src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc
index 7610174744..0e52944bb0 100644
--- a/src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc
+++ b/src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc
@@ -226,7 +226,11 @@
We create a toolbar as a child of the main window, and add the desired
actions to it:
- \snippet mainwindows/sdi/mainwindow.cpp 0
+ \code
+ fileToolBar = addToolBar(tr("File"));
+ fileToolBar->addAction(newAct);
+ fileToolBar->addAction(openAct);
+ \endcode
\dots
\snippet code/doc_src_qt4-mainwindow.cpp 1