From 4410e66f455dd47a1de90dfd095849b9ecd32134 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 20 Aug 2012 15:17:13 +0200 Subject: Making trivial snippets inline Change-Id: I8d8b5586579d3ee460b234b5a09462586ac1cfd0 Reviewed-by: J-P Nurmi Reviewed-by: Jens Bache-Wiig Reviewed-by: Casper van Donderen --- examples/widgets/doc/imageviewer.qdoc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'examples/widgets/doc/imageviewer.qdoc') 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 -- cgit v1.2.3