summaryrefslogtreecommitdiffstats
path: root/examples/widgets/doc
diff options
context:
space:
mode:
authorSergio Ahumada <sahumada@blackberry.com>2014-06-14 18:11:52 +0200
committerSergio Ahumada <sahumada@blackberry.com>2014-06-14 18:11:52 +0200
commit5721c0811a526d3372d4e9547e78339fd7915b2c (patch)
treef2f5cf1c7c2d429f38720a0df00b437938e46adf /examples/widgets/doc
parent16b90bb68343dc45a34d59083a2b62200fcc9551 (diff)
parent3f39c0f76cec121181ab9d6a0cf057c1b1aeb25c (diff)
Merge remote-tracking branch 'origin/stable' into 5.3
Diffstat (limited to 'examples/widgets/doc')
-rw-r--r--examples/widgets/doc/src/imageviewer.qdoc21
1 files changed, 12 insertions, 9 deletions
diff --git a/examples/widgets/doc/src/imageviewer.qdoc b/examples/widgets/doc/src/imageviewer.qdoc
index 96013e844a..6361e3f35b 100644
--- a/examples/widgets/doc/src/imageviewer.qdoc
+++ b/examples/widgets/doc/src/imageviewer.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -112,15 +112,19 @@
{ImageViewer}'s appearance.
\snippet widgets/imageviewer/imageviewer.cpp 1
- \snippet widgets/imageviewer/imageviewer.cpp 2
- In the \c open() slot, we show a file dialog to the user. The
- easiest way to create a QFileDialog is to use the static
- convenience functions. QFileDialog::getOpenFileName() returns an
- existing file selected by the user. If the user presses \uicontrol
- Cancel, QFileDialog returns an empty string.
+ In the \c open() slot, we show a file dialog to the user. We compile
+ a list of mime types for use as a filter by querying QImageReader
+ for the available mime type names.
+
+ We show the file dialog until a valid file name is entered or
+ the user cancels.
+
+ The function \c loadFile() is used to load the image.
+
+ \snippet widgets/imageviewer/imageviewer.cpp 2
- Unless the file name is a empty string, we check if the file's
+ In the \c loadFile() function, we check if the file's
format is an image format by constructing a QImage which tries to
load the image from the file. If the constructor returns a null
image, we use a QMessageBox to alert the user.
@@ -135,7 +139,6 @@
information message with an \uicontrol OK button (the default) is
sufficient, since the message is part of a normal operation.
- \snippet widgets/imageviewer/imageviewer.cpp 3
\snippet widgets/imageviewer/imageviewer.cpp 4
If the format is supported, we display the image in \c imageLabel