From fdb8ef6507a556589425e7a109172952c03bfd22 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 15 Jul 2015 13:29:31 +0200 Subject: 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) --- src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/widgets/doc/src/windows-and-dialogs') 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 -- cgit v1.2.3