diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-07-09 13:25:16 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-08-21 10:37:22 +0000 |
commit | 5549ba4fa512e0fed8f8dbf4f316293d04793d2f (patch) | |
tree | 5e0ffb356e5072d39da15c8967a55d3d142fabae /examples/widgets/doc | |
parent | b349289fa0003da58adb5cee51e5c2e093a6dd6f (diff) | |
download | qtbase-5549ba4fa512e0fed8f8dbf4f316293d04793d2f.tar.gz |
Polish the imageviewer example.
- Remove unneeded member variables.
- Use member initialization in the constructor.
- Use new connection syntax in createActions()
to assemble the menu there, removing the createMenus()
function.
- Fix coding style issue (braces)
- Avoid empty label showing up by setting the scroll
area invisible until an image is loaded.
- Set a new image only if image read succeeds.
- Add status bar with information message.
Task-number: QTBUG-46848
Change-Id: I32d5af70d8eb71ec16dd58a0b98c32eb2bd988d7
Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
Diffstat (limited to 'examples/widgets/doc')
-rw-r--r-- | examples/widgets/doc/src/imageviewer.qdoc | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/examples/widgets/doc/src/imageviewer.qdoc b/examples/widgets/doc/src/imageviewer.qdoc index 91ae56b5d7..4457da9d6f 100644 --- a/examples/widgets/doc/src/imageviewer.qdoc +++ b/examples/widgets/doc/src/imageviewer.qdoc @@ -287,7 +287,8 @@ \snippet widgets/imageviewer/imageviewer.cpp 18 In the private \c createAction() function, we create the - actions providing the application features. + actions providing the application features and populate + a menu with them. We assign a short-cut key to each action and connect them to the appropriate slots. We only enable the \c openAct and \c exitAct at @@ -295,16 +296,10 @@ been loaded into the application. In addition we make the \c fitToWindowAct \l {QAction::checkable}{checkable}. - \snippet widgets/imageviewer/imageviewer.cpp 19 - \snippet widgets/imageviewer/imageviewer.cpp 20 - - In the private \c createMenu() function, we add the previously - created actions to the \uicontrol File, \uicontrol View and \uicontrol Help menus. - The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus. The QMenuBar class provides a horizontal menu bar that consists of a list of pull-down menu - items. So at the end we put the menus in the \c {ImageViewer}'s + items. So we put the menus in the \c {ImageViewer}'s menu bar which we retrieve with the QMainWindow::menuBar() function. |