diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2012-08-20 15:17:13 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-21 13:41:01 +0200 |
commit | 4410e66f455dd47a1de90dfd095849b9ecd32134 (patch) | |
tree | bc5f59f59468b05e5ebb86f22dc867d223a3d873 /examples/widgets/doc/imageviewer.qdoc | |
parent | ed4389b055bd2a3b735fc846a27091b29e72a398 (diff) |
Making trivial snippets inline
Change-Id: I8d8b5586579d3ee460b234b5a09462586ac1cfd0
Reviewed-by: J-P Nurmi <j-p.nurmi@nokia.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@nokia.com>
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
Diffstat (limited to 'examples/widgets/doc/imageviewer.qdoc')
-rw-r--r-- | examples/widgets/doc/imageviewer.qdoc | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/examples/widgets/doc/imageviewer.qdoc b/examples/widgets/doc/imageviewer.qdoc index 8f8e238046..3556d52f7e 100644 --- a/examples/widgets/doc/imageviewer.qdoc +++ b/examples/widgets/doc/imageviewer.qdoc @@ -149,7 +149,9 @@ \{QWidget::adjustSize()}{adjustSize()} to achieve this, which is essentially the same as - \snippet doc/src/snippets/code/doc_src_examples_imageviewer.cpp 0 + \code + imageLabel->resize(imageLabel->pixmap()->size()); + \endcode In the \c print() slot, we first make sure that an image has been loaded into the application: @@ -160,17 +162,24 @@ If the application is built in debug mode, the \c Q_ASSERT() macro will expand to - \snippet doc/src/snippets/code/doc_src_examples_imageviewer.cpp 1 + \code + if (!imageLabel->pixmap()) + qFatal("ASSERT: "imageLabel->pixmap()" in file ..."); + \endcode In release mode, the macro simply disappear. The mode can be set in the application's \c .pro file. One way to do so is to add an option to \uicontrol qmake when building the application: - \snippet doc/src/snippets/code/doc_src_examples_imageviewer.qdoc 2 + \code + qmake "CONFIG += debug" foo.pro + \endcode or - \snippet doc/src/snippets/code/doc_src_examples_imageviewer.qdoc 3 + \code + qmake "CONFIG += release" foo.pro + \endcode Another approach is to add this line directly to the \c .pro file. @@ -318,7 +327,9 @@ Whenever we zoom in or out, we need to adjust the scroll bars in consequence. It would have been tempting to simply call - \snippet doc/src/snippets/code/doc_src_examples_imageviewer.cpp 4 + \code + scrollBar->setValue(int(factor * scrollBar->value())); + \endcode but this would make the top-left corner the focal point, not the center. Therefore we need to take into account the scroll bar |