From cfdc5628b1fc2cbafa2aebca38995e5718fcb0de Mon Sep 17 00:00:00 2001 From: Casper van Donderen Date: Mon, 7 May 2012 15:50:31 +0200 Subject: Doc: Modularize QtGui documentation. This change moves the snippets and images to the modularized directories. Change-Id: I5f86f598fbe7c47d632c613b85d94ced89ba2c29 Reviewed-by: Marius Storm-Olsen --- doc/src/gui/coordsys.qdoc | 461 ----------------- doc/src/gui/paintsystem.qdoc | 560 --------------------- doc/src/gui/qtgui.qdoc | 39 -- doc/src/images/brush-outline.png | Bin 452 -> 0 bytes doc/src/images/coordinatesystem-analogclock.png | Bin 9762 -> 0 bytes doc/src/images/coordinatesystem-line-antialias.png | Bin 17979 -> 0 bytes doc/src/images/coordinatesystem-line-raster.png | Bin 18152 -> 0 bytes doc/src/images/coordinatesystem-line.png | Bin 26694 -> 0 bytes doc/src/images/coordinatesystem-rect-antialias.png | Bin 19058 -> 0 bytes doc/src/images/coordinatesystem-rect-raster.png | Bin 18455 -> 0 bytes doc/src/images/coordinatesystem-rect.png | Bin 32307 -> 0 bytes .../images/coordinatesystem-transformations.png | Bin 59180 -> 0 bytes doc/src/images/hoverevents.png | Bin 3210 -> 0 bytes doc/src/images/paintsystem-antialiasing.png | Bin 995 -> 0 bytes doc/src/images/paintsystem-core.png | Bin 22101 -> 0 bytes doc/src/images/paintsystem-devices.png | Bin 47404 -> 0 bytes doc/src/images/paintsystem-fancygradient.png | Bin 39213 -> 0 bytes doc/src/images/paintsystem-gradients.png | Bin 16931 -> 0 bytes doc/src/images/paintsystem-icon.png | Bin 5458 -> 0 bytes doc/src/images/paintsystem-movie.png | Bin 4992 -> 0 bytes doc/src/images/paintsystem-painterpath.png | Bin 7503 -> 0 bytes doc/src/images/paintsystem-stylepainter.png | Bin 16572 -> 0 bytes doc/src/images/paintsystem-svg.png | Bin 66692 -> 0 bytes doc/src/images/qcolor-cmyk.png | Bin 18878 -> 0 bytes doc/src/images/qcolor-hsv.png | Bin 21046 -> 0 bytes doc/src/images/qcolor-hue.png | Bin 26820 -> 0 bytes doc/src/images/qcolor-rgb.png | Bin 17798 -> 0 bytes doc/src/images/qcolor-saturation.png | Bin 2150 -> 0 bytes doc/src/images/qcolor-value.png | Bin 1241 -> 0 bytes doc/src/images/qconicalgradient.png | Bin 52823 -> 0 bytes doc/src/images/qgradient-conical.png | Bin 3995 -> 0 bytes doc/src/images/qgradient-linear.png | Bin 714 -> 0 bytes doc/src/images/qgradient-radial.png | Bin 2352 -> 0 bytes doc/src/images/qimage-32bit_scaled.png | Bin 25098 -> 0 bytes doc/src/images/qimage-8bit_scaled.png | Bin 24761 -> 0 bytes doc/src/images/qlineargradient-pad.png | Bin 2260 -> 0 bytes doc/src/images/qlineargradient-reflect.png | Bin 2746 -> 0 bytes doc/src/images/qlineargradient-repeat.png | Bin 2590 -> 0 bytes doc/src/images/qmatrix-combinedtransformation.png | Bin 1707 -> 0 bytes doc/src/images/qmatrix-representation.png | Bin 10410 -> 0 bytes doc/src/images/qmatrix-simpletransformation.png | Bin 2047 -> 0 bytes doc/src/images/qpainter-affinetransformations.png | Bin 66241 -> 0 bytes doc/src/images/qpainter-arc.png | Bin 635 -> 0 bytes doc/src/images/qpainter-basicdrawing.png | Bin 18164 -> 0 bytes doc/src/images/qpainter-chord.png | Bin 632 -> 0 bytes doc/src/images/qpainter-clock.png | Bin 3128 -> 0 bytes doc/src/images/qpainter-compositiondemo.png | Bin 61015 -> 0 bytes doc/src/images/qpainter-compositionmode1.png | Bin 2418 -> 0 bytes doc/src/images/qpainter-compositionmode2.png | Bin 2131 -> 0 bytes doc/src/images/qpainter-concentriccircles.png | Bin 31294 -> 0 bytes doc/src/images/qpainter-ellipse.png | Bin 1022 -> 0 bytes doc/src/images/qpainter-gradients.png | Bin 24231 -> 0 bytes doc/src/images/qpainter-line.png | Bin 759 -> 0 bytes doc/src/images/qpainter-painterpaths.png | Bin 31985 -> 0 bytes doc/src/images/qpainter-path.png | Bin 963 -> 0 bytes doc/src/images/qpainter-pathstroking.png | Bin 30794 -> 0 bytes doc/src/images/qpainter-pie.png | Bin 1018 -> 0 bytes doc/src/images/qpainter-polygon.png | Bin 699 -> 0 bytes doc/src/images/qpainter-rectangle.png | Bin 194 -> 0 bytes doc/src/images/qpainter-rotation.png | Bin 3768 -> 0 bytes doc/src/images/qpainter-roundrect.png | Bin 433 -> 0 bytes doc/src/images/qpainter-scale.png | Bin 2828 -> 0 bytes doc/src/images/qpainter-text.png | Bin 1391 -> 0 bytes doc/src/images/qpainter-translation.png | Bin 3909 -> 0 bytes doc/src/images/qpainter-vectordeformation.png | Bin 30591 -> 0 bytes doc/src/images/qpainterpath-addellipse.png | Bin 3509 -> 0 bytes doc/src/images/qpainterpath-addpolygon.png | Bin 7625 -> 0 bytes doc/src/images/qpainterpath-addrectangle.png | Bin 1839 -> 0 bytes doc/src/images/qpainterpath-addtext.png | Bin 7406 -> 0 bytes doc/src/images/qpainterpath-arcto.png | Bin 5063 -> 0 bytes doc/src/images/qpainterpath-construction.png | Bin 2523 -> 0 bytes doc/src/images/qpainterpath-cubicto.png | Bin 4749 -> 0 bytes doc/src/images/qpainterpath-demo.png | Bin 51334 -> 0 bytes doc/src/images/qpainterpath-example.png | Bin 38746 -> 0 bytes doc/src/images/qpen-dashpattern.png | Bin 1605 -> 0 bytes doc/src/images/qpen-demo.png | Bin 49784 -> 0 bytes doc/src/images/qpen-miterlimit.png | Bin 24816 -> 0 bytes doc/src/images/qradialgradient-pad.png | Bin 11385 -> 0 bytes doc/src/images/qradialgradient-reflect.png | Bin 33668 -> 0 bytes doc/src/images/qradialgradient-repeat.png | Bin 40528 -> 0 bytes doc/src/images/qstatustipevent-action.png | Bin 10741 -> 0 bytes doc/src/images/qstatustipevent-widget.png | Bin 9417 -> 0 bytes doc/src/images/qt-fillrule-oddeven.png | Bin 7057 -> 0 bytes doc/src/images/qt-fillrule-winding.png | Bin 7205 -> 0 bytes doc/src/images/qtexttableformat-cell.png | Bin 24454 -> 0 bytes .../images/qtransform-combinedtransformation.png | Bin 935 -> 0 bytes .../images/qtransform-combinedtransformation2.png | Bin 930 -> 0 bytes doc/src/images/qtransform-representation.png | Bin 17385 -> 0 bytes doc/src/images/qtransform-simpletransformation.png | Bin 1201 -> 0 bytes doc/src/images/texttable-merge.png | Bin 746 -> 0 bytes doc/src/images/texttable-split.png | Bin 753 -> 0 bytes doc/src/snippets/brush/brush.cpp | 86 ---- doc/src/snippets/brush/gradientcreationsnippet.cpp | 62 --- doc/src/snippets/code/doc_src_qtgui.pro | 3 - .../code/src.gui.text.qtextdocumentwriter.cpp | 45 -- .../code/src_gui_accessible_qaccessible.cpp | 43 -- doc/src/snippets/code/src_gui_image_qimage.cpp | 82 --- .../snippets/code/src_gui_image_qimagereader.cpp | 66 --- .../snippets/code/src_gui_image_qimagewriter.cpp | 59 --- doc/src/snippets/code/src_gui_image_qmovie.cpp | 53 -- doc/src/snippets/code/src_gui_image_qpixmap.cpp | 58 --- .../snippets/code/src_gui_image_qpixmapcache.cpp | 61 --- .../snippets/code/src_gui_kernel_qapplication.cpp | 183 ------- .../code/src_gui_kernel_qapplication_x11.cpp | 45 -- .../snippets/code/src_gui_kernel_qclipboard.cpp | 53 -- doc/src/snippets/code/src_gui_kernel_qevent.cpp | 56 --- .../snippets/code/src_gui_kernel_qkeysequence.cpp | 59 --- .../snippets/code/src_gui_kernel_qshortcutmap.cpp | 43 -- doc/src/snippets/code/src_gui_painting_qbrush.cpp | 51 -- doc/src/snippets/code/src_gui_painting_qcolor.cpp | 49 -- doc/src/snippets/code/src_gui_painting_qmatrix.cpp | 62 --- .../snippets/code/src_gui_painting_qpainter.cpp | 259 ---------- .../code/src_gui_painting_qpainterpath.cpp | 149 ------ doc/src/snippets/code/src_gui_painting_qpen.cpp | 81 --- doc/src/snippets/code/src_gui_painting_qregion.cpp | 53 -- .../code/src_gui_painting_qregion_unix.cpp | 54 -- .../snippets/code/src_gui_painting_qtransform.cpp | 82 --- .../snippets/code/src_gui_qopenglshaderprogram.cpp | 94 ---- doc/src/snippets/code/src_gui_text_qfont.cpp | 67 --- .../snippets/code/src_gui_text_qfontmetrics.cpp | 54 -- .../code/src_gui_text_qsyntaxhighlighter.cpp | 126 ----- doc/src/snippets/code/src_gui_text_qtextcursor.cpp | 80 --- .../snippets/code/src_gui_text_qtextdocument.cpp | 43 -- doc/src/snippets/code/src_gui_text_qtextlayout.cpp | 62 --- .../code/src_gui_util_qdesktopservices.cpp | 60 --- .../snippets/code/src_gui_widgets_qvalidator.cpp | 135 ----- doc/src/snippets/dragging/mainwindow.cpp | 110 ---- doc/src/snippets/droparea.cpp | 140 ------ doc/src/snippets/image/image.cpp | 104 ---- doc/src/snippets/image/supportedformat.cpp | 52 -- doc/src/snippets/matrix/matrix.cpp | 140 ------ doc/src/snippets/picture/picture.cpp | 151 ------ doc/src/snippets/polygon/polygon.cpp | 112 ----- doc/src/snippets/qfontdatabase/main.cpp | 74 --- doc/src/snippets/qstatustipevent/main.cpp | 82 --- doc/src/snippets/separations/finalwidget.cpp | 126 ----- doc/src/snippets/textblock-fragments/xmlwriter.cpp | 117 ----- doc/src/snippets/textdocument-css/main.cpp | 59 --- .../snippets/textdocument-listitemstyles/main.cpp | 52 -- .../textdocument-listitemstyles/mainwindow.cpp | 84 ---- .../textdocument-listitemstyles/mainwindow.h | 65 --- .../textdocument-listitemstyles.pro | 3 - doc/src/snippets/textdocument-lists/mainwindow.cpp | 192 ------- doc/src/snippets/textdocument-resources/main.cpp | 83 --- .../textdocument-resources.pro | 1 - .../snippets/textdocument-tables/mainwindow.cpp | 204 -------- doc/src/snippets/textdocument-texttable/main.cpp | 84 ---- doc/src/snippets/textdocumentendsnippet.cpp | 56 --- doc/src/snippets/transform/main.cpp | 140 ------ 149 files changed, 5909 deletions(-) delete mode 100644 doc/src/gui/coordsys.qdoc delete mode 100644 doc/src/gui/paintsystem.qdoc delete mode 100644 doc/src/gui/qtgui.qdoc delete mode 100644 doc/src/images/brush-outline.png delete mode 100644 doc/src/images/coordinatesystem-analogclock.png delete mode 100644 doc/src/images/coordinatesystem-line-antialias.png delete mode 100644 doc/src/images/coordinatesystem-line-raster.png delete mode 100644 doc/src/images/coordinatesystem-line.png delete mode 100644 doc/src/images/coordinatesystem-rect-antialias.png delete mode 100644 doc/src/images/coordinatesystem-rect-raster.png delete mode 100644 doc/src/images/coordinatesystem-rect.png delete mode 100644 doc/src/images/coordinatesystem-transformations.png delete mode 100644 doc/src/images/hoverevents.png delete mode 100644 doc/src/images/paintsystem-antialiasing.png delete mode 100644 doc/src/images/paintsystem-core.png delete mode 100644 doc/src/images/paintsystem-devices.png delete mode 100644 doc/src/images/paintsystem-fancygradient.png delete mode 100644 doc/src/images/paintsystem-gradients.png delete mode 100644 doc/src/images/paintsystem-icon.png delete mode 100644 doc/src/images/paintsystem-movie.png delete mode 100644 doc/src/images/paintsystem-painterpath.png delete mode 100644 doc/src/images/paintsystem-stylepainter.png delete mode 100644 doc/src/images/paintsystem-svg.png delete mode 100644 doc/src/images/qcolor-cmyk.png delete mode 100644 doc/src/images/qcolor-hsv.png delete mode 100644 doc/src/images/qcolor-hue.png delete mode 100644 doc/src/images/qcolor-rgb.png delete mode 100644 doc/src/images/qcolor-saturation.png delete mode 100644 doc/src/images/qcolor-value.png delete mode 100644 doc/src/images/qconicalgradient.png delete mode 100644 doc/src/images/qgradient-conical.png delete mode 100644 doc/src/images/qgradient-linear.png delete mode 100644 doc/src/images/qgradient-radial.png delete mode 100644 doc/src/images/qimage-32bit_scaled.png delete mode 100644 doc/src/images/qimage-8bit_scaled.png delete mode 100644 doc/src/images/qlineargradient-pad.png delete mode 100644 doc/src/images/qlineargradient-reflect.png delete mode 100644 doc/src/images/qlineargradient-repeat.png delete mode 100644 doc/src/images/qmatrix-combinedtransformation.png delete mode 100644 doc/src/images/qmatrix-representation.png delete mode 100644 doc/src/images/qmatrix-simpletransformation.png delete mode 100644 doc/src/images/qpainter-affinetransformations.png delete mode 100644 doc/src/images/qpainter-arc.png delete mode 100644 doc/src/images/qpainter-basicdrawing.png delete mode 100644 doc/src/images/qpainter-chord.png delete mode 100644 doc/src/images/qpainter-clock.png delete mode 100644 doc/src/images/qpainter-compositiondemo.png delete mode 100644 doc/src/images/qpainter-compositionmode1.png delete mode 100644 doc/src/images/qpainter-compositionmode2.png delete mode 100644 doc/src/images/qpainter-concentriccircles.png delete mode 100644 doc/src/images/qpainter-ellipse.png delete mode 100644 doc/src/images/qpainter-gradients.png delete mode 100644 doc/src/images/qpainter-line.png delete mode 100644 doc/src/images/qpainter-painterpaths.png delete mode 100644 doc/src/images/qpainter-path.png delete mode 100644 doc/src/images/qpainter-pathstroking.png delete mode 100644 doc/src/images/qpainter-pie.png delete mode 100644 doc/src/images/qpainter-polygon.png delete mode 100644 doc/src/images/qpainter-rectangle.png delete mode 100644 doc/src/images/qpainter-rotation.png delete mode 100644 doc/src/images/qpainter-roundrect.png delete mode 100644 doc/src/images/qpainter-scale.png delete mode 100644 doc/src/images/qpainter-text.png delete mode 100644 doc/src/images/qpainter-translation.png delete mode 100644 doc/src/images/qpainter-vectordeformation.png delete mode 100644 doc/src/images/qpainterpath-addellipse.png delete mode 100644 doc/src/images/qpainterpath-addpolygon.png delete mode 100644 doc/src/images/qpainterpath-addrectangle.png delete mode 100644 doc/src/images/qpainterpath-addtext.png delete mode 100644 doc/src/images/qpainterpath-arcto.png delete mode 100644 doc/src/images/qpainterpath-construction.png delete mode 100644 doc/src/images/qpainterpath-cubicto.png delete mode 100644 doc/src/images/qpainterpath-demo.png delete mode 100644 doc/src/images/qpainterpath-example.png delete mode 100644 doc/src/images/qpen-dashpattern.png delete mode 100644 doc/src/images/qpen-demo.png delete mode 100644 doc/src/images/qpen-miterlimit.png delete mode 100644 doc/src/images/qradialgradient-pad.png delete mode 100644 doc/src/images/qradialgradient-reflect.png delete mode 100644 doc/src/images/qradialgradient-repeat.png delete mode 100644 doc/src/images/qstatustipevent-action.png delete mode 100644 doc/src/images/qstatustipevent-widget.png delete mode 100644 doc/src/images/qt-fillrule-oddeven.png delete mode 100644 doc/src/images/qt-fillrule-winding.png delete mode 100644 doc/src/images/qtexttableformat-cell.png delete mode 100644 doc/src/images/qtransform-combinedtransformation.png delete mode 100644 doc/src/images/qtransform-combinedtransformation2.png delete mode 100644 doc/src/images/qtransform-representation.png delete mode 100644 doc/src/images/qtransform-simpletransformation.png delete mode 100644 doc/src/images/texttable-merge.png delete mode 100644 doc/src/images/texttable-split.png delete mode 100644 doc/src/snippets/brush/brush.cpp delete mode 100644 doc/src/snippets/brush/gradientcreationsnippet.cpp delete mode 100644 doc/src/snippets/code/doc_src_qtgui.pro delete mode 100644 doc/src/snippets/code/src.gui.text.qtextdocumentwriter.cpp delete mode 100644 doc/src/snippets/code/src_gui_accessible_qaccessible.cpp delete mode 100644 doc/src/snippets/code/src_gui_image_qimage.cpp delete mode 100644 doc/src/snippets/code/src_gui_image_qimagereader.cpp delete mode 100644 doc/src/snippets/code/src_gui_image_qimagewriter.cpp delete mode 100644 doc/src/snippets/code/src_gui_image_qmovie.cpp delete mode 100644 doc/src/snippets/code/src_gui_image_qpixmap.cpp delete mode 100644 doc/src/snippets/code/src_gui_image_qpixmapcache.cpp delete mode 100644 doc/src/snippets/code/src_gui_kernel_qapplication.cpp delete mode 100644 doc/src/snippets/code/src_gui_kernel_qapplication_x11.cpp delete mode 100644 doc/src/snippets/code/src_gui_kernel_qclipboard.cpp delete mode 100644 doc/src/snippets/code/src_gui_kernel_qevent.cpp delete mode 100644 doc/src/snippets/code/src_gui_kernel_qkeysequence.cpp delete mode 100644 doc/src/snippets/code/src_gui_kernel_qshortcutmap.cpp delete mode 100644 doc/src/snippets/code/src_gui_painting_qbrush.cpp delete mode 100644 doc/src/snippets/code/src_gui_painting_qcolor.cpp delete mode 100644 doc/src/snippets/code/src_gui_painting_qmatrix.cpp delete mode 100644 doc/src/snippets/code/src_gui_painting_qpainter.cpp delete mode 100644 doc/src/snippets/code/src_gui_painting_qpainterpath.cpp delete mode 100644 doc/src/snippets/code/src_gui_painting_qpen.cpp delete mode 100644 doc/src/snippets/code/src_gui_painting_qregion.cpp delete mode 100644 doc/src/snippets/code/src_gui_painting_qregion_unix.cpp delete mode 100644 doc/src/snippets/code/src_gui_painting_qtransform.cpp delete mode 100644 doc/src/snippets/code/src_gui_qopenglshaderprogram.cpp delete mode 100644 doc/src/snippets/code/src_gui_text_qfont.cpp delete mode 100644 doc/src/snippets/code/src_gui_text_qfontmetrics.cpp delete mode 100644 doc/src/snippets/code/src_gui_text_qsyntaxhighlighter.cpp delete mode 100644 doc/src/snippets/code/src_gui_text_qtextcursor.cpp delete mode 100644 doc/src/snippets/code/src_gui_text_qtextdocument.cpp delete mode 100644 doc/src/snippets/code/src_gui_text_qtextlayout.cpp delete mode 100644 doc/src/snippets/code/src_gui_util_qdesktopservices.cpp delete mode 100644 doc/src/snippets/code/src_gui_widgets_qvalidator.cpp delete mode 100644 doc/src/snippets/dragging/mainwindow.cpp delete mode 100644 doc/src/snippets/droparea.cpp delete mode 100644 doc/src/snippets/image/image.cpp delete mode 100644 doc/src/snippets/image/supportedformat.cpp delete mode 100644 doc/src/snippets/matrix/matrix.cpp delete mode 100644 doc/src/snippets/picture/picture.cpp delete mode 100644 doc/src/snippets/polygon/polygon.cpp delete mode 100644 doc/src/snippets/qfontdatabase/main.cpp delete mode 100644 doc/src/snippets/qstatustipevent/main.cpp delete mode 100644 doc/src/snippets/separations/finalwidget.cpp delete mode 100644 doc/src/snippets/textblock-fragments/xmlwriter.cpp delete mode 100644 doc/src/snippets/textdocument-css/main.cpp delete mode 100644 doc/src/snippets/textdocument-listitemstyles/main.cpp delete mode 100644 doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp delete mode 100644 doc/src/snippets/textdocument-listitemstyles/mainwindow.h delete mode 100644 doc/src/snippets/textdocument-listitemstyles/textdocument-listitemstyles.pro delete mode 100644 doc/src/snippets/textdocument-lists/mainwindow.cpp delete mode 100644 doc/src/snippets/textdocument-resources/main.cpp delete mode 100644 doc/src/snippets/textdocument-resources/textdocument-resources.pro delete mode 100644 doc/src/snippets/textdocument-tables/mainwindow.cpp delete mode 100644 doc/src/snippets/textdocument-texttable/main.cpp delete mode 100644 doc/src/snippets/textdocumentendsnippet.cpp delete mode 100644 doc/src/snippets/transform/main.cpp (limited to 'doc/src') diff --git a/doc/src/gui/coordsys.qdoc b/doc/src/gui/coordsys.qdoc deleted file mode 100644 index 655dbf7cf3..0000000000 --- a/doc/src/gui/coordsys.qdoc +++ /dev/null @@ -1,461 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** GNU Free Documentation License -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms -** and conditions contained in a signed written agreement between you -** and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page coordsys.html - \title Coordinate System - \ingroup qt-graphics - \ingroup best-practices - \brief Information about the coordinate system used by the paint - system. - - The coordinate system is controlled by the QPainter - class. Together with the QPaintDevice and QPaintEngine classes, - QPainter form the basis of Qt's painting system, Arthur. QPainter - is used to perform drawing operations, QPaintDevice is an - abstraction of a two-dimensional space that can be painted on - using a QPainter, and QPaintEngine provides the interface that the - painter uses to draw onto different types of devices. - - The QPaintDevice class is the base class of objects that can be - painted: Its drawing capabilities are inherited by the QWidget, - QPixmap, QPicture, QImage, and QPrinter classes. The default - coordinate system of a paint device has its origin at the top-left - corner. The \e x values increase to the right and the \e y values - increase downwards. The default unit is one pixel on pixel-based - devices and one point (1/72 of an inch) on printers. - - The mapping of the logical QPainter coordinates to the physical - QPaintDevice coordinates are handled by QPainter's transformation - matrix, viewport and "window". The logical and physical coordinate - systems coincide by default. QPainter also supports coordinate - transformations (e.g. rotation and scaling). - - \tableofcontents - - \section1 Rendering - - \section2 Logical Representation - - The size (width and height) of a graphics primitive always - correspond to its mathematical model, ignoring the width of the - pen it is rendered with: - - \table - \row - \li \inlineimage coordinatesystem-rect.png - \li \inlineimage coordinatesystem-line.png - \row - \li QRect(1, 2, 6, 4) - \li QLine(2, 7, 6, 1) - \endtable - - \section2 Aliased Painting - - When drawing, the pixel rendering is controlled by the - QPainter::Antialiasing render hint. - - The \l {QPainter::RenderHint}{RenderHint} enum is used to specify - flags to QPainter that may or may not be respected by any given - engine. The QPainter::Antialiasing value indicates that the engine - should antialias edges of primitives if possible, i.e. smoothing - the edges by using different color intensities. - - But by default the painter is \e aliased and other rules apply: - When rendering with a one pixel wide pen the pixels will be - rendered to the \e {right and below the mathematically defined - points}. For example: - - \table - \row - \li \inlineimage coordinatesystem-rect-raster.png - \li \inlineimage coordinatesystem-line-raster.png - - \row - \li - \snippet doc/src/snippets/code/doc_src_coordsys.cpp 0 - - \li - \snippet doc/src/snippets/code/doc_src_coordsys.cpp 1 - \endtable - - When rendering with a pen with an even number of pixels, the - pixels will be rendered symetrically around the mathematical - defined points, while rendering with a pen with an odd number of - pixels, the spare pixel will be rendered to the right and below - the mathematical point as in the one pixel case. See the QRectF - diagrams below for concrete examples. - - \table - \header - \li {3,1} QRectF - \row - \li \inlineimage qrect-diagram-zero.png - \li \inlineimage qrectf-diagram-one.png - \row - \li Logical representation - \li One pixel wide pen - \row - \li \inlineimage qrectf-diagram-two.png - \li \inlineimage qrectf-diagram-three.png - \row - \li Two pixel wide pen - \li Three pixel wide pen - \endtable - - Note that for historical reasons the return value of the - QRect::right() and QRect::bottom() functions deviate from the true - bottom-right corner of the rectangle. - - QRect's \l {QRect::right()}{right()} function returns \l - {QRect::left()}{left()} + \l {QRect::width()}{width()} - 1 and the - \l {QRect::bottom()}{bottom()} function returns \l - {QRect::top()}{top()} + \l {QRect::height()}{height()} - 1. The - bottom-right green point in the diagrams shows the return - coordinates of these functions. - - We recommend that you simply use QRectF instead: The QRectF class - defines a rectangle in the plane using floating point coordinates - for accuracy (QRect uses integer coordinates), and the - QRectF::right() and QRectF::bottom() functions \e do return the - true bottom-right corner. - - Alternatively, using QRect, apply \l {QRect::x()}{x()} + \l - {QRect::width()}{width()} and \l {QRect::y()}{y()} + \l - {QRect::height()}{height()} to find the bottom-right corner, and - avoid the \l {QRect::right()}{right()} and \l - {QRect::bottom()}{bottom()} functions. - - \section2 Anti-aliased Painting - - If you set QPainter's \l {QPainter::Antialiasing}{anti-aliasing} - render hint, the pixels will be rendered symetrically on both - sides of the mathematically defined points: - - \table - \row - \li \inlineimage coordinatesystem-rect-antialias.png - \li \inlineimage coordinatesystem-line-antialias.png - \row - \li - - \snippet doc/src/snippets/code/doc_src_coordsys.cpp 2 - - \li - \snippet doc/src/snippets/code/doc_src_coordsys.cpp 3 - \endtable - - \section1 Transformations - - By default, the QPainter operates on the associated device's own - coordinate system, but it also has complete support for affine - coordinate transformations. - - You can scale the coordinate system by a given offset using the - QPainter::scale() function, you can rotate it clockwise using the - QPainter::rotate() function and you can translate it (i.e. adding - a given offset to the points) using the QPainter::translate() - function. - - \table - \row - \li \inlineimage qpainter-clock.png - \li \inlineimage qpainter-rotation.png - \li \inlineimage qpainter-scale.png - \li \inlineimage qpainter-translation.png - \row - \li nop - \li \l {QPainter::rotate()}{rotate()} - \li \l {QPainter::scale()}{scale()} - \li \l {QPainter::translate()}{translate()} - \endtable - - You can also twist the coordinate system around the origin using - the QPainter::shear() function. See the \l {painting/affine}{Affine - Transformations} example for a visualization of a sheared coordinate - system. All the transformation operations operate on QPainter's - transformation matrix that you can retrieve using the - QPainter::worldTransform() function. A matrix transforms a point - in the plane to another point. - - If you need the same transformations over and over, you can also - use QTransform objects and the QPainter::worldTransform() and - QPainter::setWorldTransform() functions. You can at any time save the - QPainter's transformation matrix by calling the QPainter::save() - function which saves the matrix on an internal stack. The - QPainter::restore() function pops it back. - - One frequent need for the transformation matrix is when reusing - the same drawing code on a variety of paint devices. Without - transformations, the results are tightly bound to the resolution - of the paint device. Printers have high resolution, e.g. 600 dots - per inch, whereas screens often have between 72 and 100 dots per - inch. - - \table 100% - \header - \li {2,1} Analog Clock Example - \row - \li \inlineimage coordinatesystem-analogclock.png - \li - The Analog Clock example shows how to draw the contents of a - custom widget using QPainter's transformation matrix. - - Qt's example directory provides a complete walk-through of the - example. Here, we will only review the example's \l - {QWidget::paintEvent()}{paintEvent()} function to see how we can - use the transformation matrix (i.e. QPainter's matrix functions) - to draw the clock's face. - - We recommend compiling and running this example before you read - any further. In particular, try resizing the window to different - sizes. - - \row - \li {2,1} - - \snippet examples/widgets/analogclock/analogclock.cpp 9 - - First, we set up the painter. We translate the coordinate system - so that point (0, 0) is in the widget's center, instead of being - at the top-left corner. We also scale the system by \c side / 100, - where \c side is either the widget's width or the height, - whichever is shortest. We want the clock to be square, even if the - device isn't. - - This will give us a 200 x 200 square area, with the origin (0, 0) - in the center, that we can draw on. What we draw will show up in - the largest possible square that will fit in the widget. - - See also the \l {Window-Viewport Conversion} section. - - \snippet examples/widgets/analogclock/analogclock.cpp 18 - - We draw the clock's hour hand by rotating the coordinate system - and calling QPainter::drawConvexPolygon(). Thank's to the - rotation, it's drawn pointed in the right direction. - - The polygon is specified as an array of alternating \e x, \e y - values, stored in the \c hourHand static variable (defined at the - beginning of the function), which corresponds to the four points - (2, 0), (0, 2), (-2, 0), and (0, -25). - - The calls to QPainter::save() and QPainter::restore() surrounding - the code guarantees that the code that follows won't be disturbed - by the transformations we've used. - - \snippet examples/widgets/analogclock/analogclock.cpp 24 - - We do the same for the clock's minute hand, which is defined by - the four points (1, 0), (0, 1), (-1, 0), and (0, -40). These - coordinates specify a hand that is thinner and longer than the - minute hand. - - \snippet examples/widgets/analogclock/analogclock.cpp 27 - - Finally, we draw the clock face, which consists of twelve short - lines at 30-degree intervals. At the end of that, the painter is - rotated in a way which isn't very useful, but we're done with - painting so that doesn't matter. - \endtable - - For a demonstation of Qt's ability to perform affine - transformations on painting operations, see the \l - {painting/affine}{Affine Transformations} example which allows the user - to experiment with the transformation operations. See also the \l - {painting/transformations}{Transformations} example which shows - how transformations influence the way that QPainter renders - graphics primitives. In particular, it shows how the order of - transformations affects the result. - - For more information about the transformation matrix, see the - QTransform documentation. - - \section1 Window-Viewport Conversion - - When drawing with QPainter, we specify points using logical - coordinates which then are converted into the physical coordinates - of the paint device. - - The mapping of the logical coordinates to the physical coordinates - are handled by QPainter's world transformation \l - {QPainter::worldTransform()}{worldTransform()} (described in the \l - Transformations section), and QPainter's \l - {QPainter::viewport()}{viewport()} and \l - {QPainter::window()}{window()}. The viewport represents the - physical coordinates specifying an arbitrary rectangle. The - "window" describes the same rectangle in logical coordinates. By - default the logical and physical coordinate systems coincide, and - are equivalent to the paint device's rectangle. - - Using window-viewport conversion you can make the logical - coordinate system fit your preferences. The mechanism can also be - used to make the drawing code independent of the paint device. You - can, for example, make the logical coordinates extend from (-50, - -50) to (50, 50) with (0, 0) in the center by calling the - QPainter::setWindow() function: - - \snippet doc/src/snippets/code/doc_src_coordsys.cpp 4 - - Now, the logical coordinates (-50,-50) correspond to the paint - device's physical coordinates (0, 0). Independent of the paint - device, your painting code will always operate on the specified - logical coordinates. - - By setting the "window" or viewport rectangle, you perform a - linear transformation of the coordinates. Note that each corner of - the "window" maps to the corresponding corner of the viewport, and - vice versa. For that reason it normally is a good idea to let the - viewport and "window" maintain the same aspect ratio to prevent - deformation: - - \snippet doc/src/snippets/code/doc_src_coordsys.cpp 5 - - If we make the logical coordinate system a square, we should also - make the viewport a square using the QPainter::setViewport() - function. In the example above we make it equivalent to the - largest square that fit into the paint device's rectangle. By - taking the paint device's size into consideration when setting the - window or viewport, it is possible to keep the drawing code - independent of the paint device. - - Note that the window-viewport conversion is only a linear - transformation, i.e. it does not perform clipping. This means that - if you paint outside the currently set "window", your painting is - still transformed to the viewport using the same linear algebraic - approach. - - \image coordinatesystem-transformations.png - - The viewport, "window" and transformation matrix determine how - logical QPainter coordinates map to the paint device's physical - coordinates. By default the world transformation matrix is the - identity matrix, and the "window" and viewport settings are - equivalent to the paint device's settings, i.e. the world, - "window" and device coordinate systems are equivalent, but as we - have seen, the systems can be manipulated using transformation - operations and window-viewport conversion. The illustration above - describes the process. - - \omit - \section1 Related Classes - - Qt's paint system, Arthur, is primarily based on the QPainter, - QPaintDevice, and QPaintEngine classes: - - \table - \header \li Class \li Description - \row - \li QPainter - \li - The QPainter class performs low-level painting on widgets and - other paint devices. QPainter can operate on any object that - inherits the QPaintDevice class, using the same code. - \row - \li QPaintDevice - \li - The QPaintDevice class is the base class of objects that can be - painted. Qt provides several devices: QWidget, QImage, QPixmap, - QPrinter and QPicture, and other devices can also be defined by - subclassing QPaintDevice. - \row - \li QPaintEngine - \li - The QPaintEngine class provides an abstract definition of how - QPainter draws to a given device on a given platform. Qt 4 - provides several premade implementations of QPaintEngine for the - different painter backends we support; it provides one paint - engine for each supported window system and painting - frameworkt. You normally don't need to use this class directly. - \endtable - - The 2D transformations of the coordinate system are specified - using the QTransform class: - - \table - \header \li Class \li Description - \row - \li QTransform - \li - A 3 x 3 transformation matrix. Use QTransform to rotate, shear, - scale, or translate the coordinate system. - \endtable - - In addition Qt provides several graphics primitive classes. Some - of these classes exist in two versions: an \c{int}-based version - and a \c{qreal}-based version. For these, the \c qreal version's - name is suffixed with an \c F. - - \table - \header \li Class \li Description - \row - \li \l{QPoint}(\l{QPointF}{F}) - \li - A single 2D point in the coordinate system. Most functions in Qt - that deal with points can accept either a QPoint, a QPointF, two - \c{int}s, or two \c{qreal}s. - \row - \li \l{QSize}(\l{QSizeF}{F}) - \li - A single 2D vector. Internally, QPoint and QSize are the same, but - a point is not the same as a size, so both classes exist. Again, - most functions accept either QSizeF, a QSize, two \c{int}s, or two - \c{qreal}s. - \row - \li \l{QRect}(\l{QRectF}{F}) - \li - A 2D rectangle. Most functions accept either a QRectF, a QRect, - four \c{int}s, or four \c {qreal}s. - \row - \li \l{QLine}(\l{QLineF}{F}) - \li - A 2D finite-length line, characterized by a start point and an end - point. - \row - \li \l{QPolygon}(\l{QPolygonF}{F}) - \li - A 2D polygon. A polygon is a vector of \c{QPoint(F)}s. If the - first and last points are the same, the polygon is closed. - \row - \li QPainterPath - \li - A vectorial specification of a 2D shape. Painter paths are the - ultimate painting primitive, in the sense that any shape - (rectange, ellipse, spline) or combination of shapes can be - expressed as a path. A path specifies both an outline and an area. - \row - \li QRegion - \li - An area in a paint device, expressed as a list of - \l{QRect}s. In general, we recommend using the vectorial - QPainterPath class instead of QRegion for specifying areas, - because QPainterPath handles painter transformations much better. - \endtable - \endomit - - \sa {Analog Clock Example}, {Transformations Example} -*/ diff --git a/doc/src/gui/paintsystem.qdoc b/doc/src/gui/paintsystem.qdoc deleted file mode 100644 index 4b33e4fed3..0000000000 --- a/doc/src/gui/paintsystem.qdoc +++ /dev/null @@ -1,560 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** GNU Free Documentation License -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms -** and conditions contained in a signed written agreement between you -** and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \group painting - \title Painting Classes - \ingroup groups - - \brief Classes that provide support for painting. - - See also this introduction to the \link coordsys.html Qt - coordinate system. \endlink -*/ - -/*! - \group painting-3D - \title Rendering in 3D - \ingroup groups - - \brief Classes that provide support for rendering in 3D. -*/ - -/*! - \page paintsystem.html - \title Paint System - \brief A system for painting on the screen or on print devices using the same API - \ingroup qt-graphics - \ingroup frameworks-technologies - \ingroup qt-basic-concepts - - - Qt's paint system enables painting on screen and print devices - using the same API, and is primarily based on the QPainter, - QPaintDevice, and QPaintEngine classes. - - QPainter is used to perform drawing operations, QPaintDevice is an - abstraction of a two-dimensional space that can be painted on - using a QPainter, and QPaintEngine provides the interface that the - painter uses to draw onto different types of devices. The - QPaintEngine class is used internally by QPainter and - QPaintDevice, and is hidden from application programmers unless - they create their own device type. - - \image paintsystem-core.png - - The main benefit of this approach is that all painting follows the - same painting pipeline making it easy to add support for new - features and providing default implementations for unsupported - ones. - - \section1 Topics - \list - \li \l{Classes for Painting} - \li \l{Paint Devices and Backends} - \li \l{Drawing and Filling} - \li \l{Coordinate System} - \li \l{Reading and Writing Image Files} - \li \l{Styling} - \li \l{Printing with Qt} - \endlist - - \section1 Classes for Painting - - These classes provide support for painting onto a paint device. - - \annotatedlist painting - - Alternatively, Qt provides the QtOpenGL module, offering classes - that makes it easy to use OpenGL in Qt applications. Among others, - the module provides an OpenGL widget class that can be used just - like any other Qt widget, except that it opens an OpenGL display - buffer where the OpenGL API can be used to render the contents. -*/ - - -/*! - \page paintsystem-devices.html - \title Paint Devices and Backends - - \contentspage The Paint System - \nextpage Drawing and Filling - - \section1 Creating a Paint Device - - The QPaintDevice class is the base class of objects that can be - painted, i.e. QPainter can draw on any QPaintDevice - subclass. QPaintDevice's drawing capabilities are currently - implemented by the QWidget, QImage, QPixmap, QGLWidget, - QGLPixelBuffer, QPicture and QPrinter subclasses. - - \image paintsystem-devices.png - - \table 100% - \row \li \b Widget - - The QWidget class is the base class of all user interface - objects. The widget is the atom of the user interface: it receives - mouse, keyboard and other events from the window system, and - paints a representation of itself on the screen. - - \row \li \b Image - - The QImage class provides a hardware-independent image - representation which is designed and optimized for I/O, and for - direct pixel access and manipulation. QImage supports several - image formats including monochrome, 8-bit, 32-bit and - alpha-blended images. - - One advantage of using QImage as a paint device is that it is - possible to guarantee the pixel exactness of any drawing operation - in a platform-independent way. Another benefit is that the - painting can be performed in another thread than the current GUI - thread. - - \row \li \b Pixmap - - The QPixmap class is an off-screen image representation which is - designed and optimized for showing images on screen. Unlike - QImage, the pixel data in a pixmap is internal and is managed by - the underlying window system, i.e. pixels can only be accessed - through QPainter functions or by converting the QPixmap to a - QImage. - - To optimize drawing with QPixmap, Qt provides the QPixmapCache - class which can be used to store temporary pixmaps that are - expensive to generate without using more storage space than the - cache limit. - - Qt also provides the QBitmap convenience class, inheriting - QPixmap. QBitmap guarantees monochrome (1-bit depth) pixmaps, and - is mainly used for creating custom QCursor and QBrush objects, - constructing QRegion objects, and for setting masks for pixmaps - and widgets. - - \row \li \b {OpenGL Widget} - - As mentioned previously, Qt provides the QtOpenGL module offering - classes that makes it easy to use OpenGL in Qt applications. For - example, the QGLWidget enables the OpenGL API for - rendering. - - But QGLWidget is also a QWidget subclass, and can be used by - QPainter as any other paint device. One huge benefit from this is - that it enables Qt to utilize the high performance of OpenGL for - most drawing operations, such as transformations and pixmap - drawing. - - \row \li \b {Pixel Buffer} - - The QtOpenGL module also provides the QGLPixelBuffer class which - inherits QPaintDevice directly. - - QGLPixelBuffer encapsulates an OpenGL pbuffer. Rendering into a - pbuffer is normally done using full hardware acceleration which - can be significantly faster than rendering into a QPixmap. - - \row \li \b {Framebuffer Object} - - The QtOpenGL module also provides the QGLFramebufferObject class - which inherits QPaintDevice directly. - - QGLFramebufferObject encapsulates an OpenGL framebuffer object. - Framebuffer objects can also be used for off-screen rendering, and - offer several advantages over pixel buffers for this purpose. - These are described in the QGLFramebufferObject class documentation. - - \row \li \b {Picture} - - The QPicture class is a paint device that records and replays - QPainter commands. A picture serializes painter commands to an IO - device in a platform-independent format. QPicture is also - resolution independent, i.e. a QPicture can be displayed on - different devices (for example svg, pdf, ps, printer and screen) - looking the same. - - Qt provides the QPicture::load() and QPicture::save() functions - as well as streaming operators for loading and saving pictures. - - \row \li \b {Printer} - - The QPrinter class is a paint device that paints on a printer. On - Windows or Mac OS X, QPrinter uses the built-in printer - drivers. On X11, QPrinter generates postscript and sends that to - lpr, lp, or another print program. QPrinter can also print to any - other QPrintEngine object. - - The QPrintEngine class defines an interface for how QPrinter - interacts with a given printing subsystem. The common case when - creating your own print engine, is to derive from both - QPaintEngine and QPrintEngine. - - The output format is by default determined by the platform the - printer is running on, but by explicitly setting the output format - to QPrinter::PdfFormat, QPrinter will generate its output as a PDF - file. - - \row \li \b {Custom Backends} - - Support for a new backend can be implemented by deriving from the - QPaintDevice class and reimplementing the virtual - QPaintDevice::paintEngine() function to tell QPainter which paint - engine should be used to draw on this particular device. To - actually be able to draw on the device, this paint engine must be - a custom paint engine created by deriving from the QPaintEngine - class. - - \endtable - - \section1 Selecting the Painting Backend - - Since Qt 4.5, it is possible to replace the paint engines and paint - devices used for widgets, pixmaps and the offscreen double buffer. By - default the backends are: - - \table - \row - \li Windows - \li Software Rasterizer - \row - \li X11 - \li X11 - \row - \li Mac OS X - \li CoreGraphics - \row - \li Embedded - \li Software Rasterizer - \endtable - - Passing a command line parameter to the application, such as, - \c{-graphicssystem raster}, specifies that Qt should use the software - rasterizer for this application. The Software rasterizer is fully - supported on all platforms. - - \code - > analogclock -graphicssystem raster - \endcode - - There is also a \c{-graphicssystem opengl} mode that uses OpenGL for - all drawing. Currently, this engine is experimental as it does not draw - everything correctly. - - Qt also supports being configured using \c {-graphicssystem - raster|opengl} in which case all applications will use the - specified graphics system for its graphics. -*/ - -/*! - \page paintsystem-drawing.html - \title Drawing and Filling - - \previouspage Paint Devices and Backends - \contentspage The Paint System - \nextpage Coordinate System - - \section1 Drawing - - QPainter provides highly optimized functions to do most of the - drawing GUI programs require. It can draw everything from simple - graphical primitives (represented by the QPoint, QLine, QRect, - QRegion and QPolygon classes) to complex shapes like vector - paths. In Qt vector paths are represented by the QPainterPath - class. QPainterPath provides a container for painting operations, - enabling graphical shapes to be constructed and reused. - - \table 100% - \row - \li \image paintsystem-painterpath.png - \li \b QPainterPath - - A painter path is an object composed of lines and curves. For - example, a rectangle is composed by lines and an ellipse is - composed by curves. - - The main advantage of painter paths over normal drawing operations - is that complex shapes only need to be created once; then they can - be drawn many times using only calls to the QPainter::drawPath() - function. - - A QPainterPath object can be used for filling, outlining, and - clipping. To generate fillable outlines for a given painter path, - use the QPainterPathStroker class. - - \endtable - - Lines and outlines are drawn using the QPen class. A pen is - defined by its style (i.e. its line-type), width, brush, how the - endpoints are drawn (cap-style) and how joins between two - connected lines are drawn (join-style). The pen's brush is a - QBrush object used to fill strokes generated with the pen, - i.e. the QBrush class defines the fill pattern. - - QPainter can also draw aligned text and pixmaps. - - When drawing text, the font is specified using the QFont class. Qt - will use the font with the specified attributes, or if no matching - font exists, Qt will use the closest matching installed font. The - attributes of the font that is actually used can be retrieved - using the QFontInfo class. In addition, the QFontMetrics class - provides the font measurements, and the QFontDatabase class - provides information about the fonts available in the underlying - window system. - - Normally, QPainter draws in a "natural" coordinate system, but it - is able to perform view and world transformations using the - QTransform class. For more information, see \l {Coordinate - System}, which also describes the rendering process, i.e. the - relation between the logical representation and the rendered - pixels, and the benefits of anti-aliased painting. - - \table 100% - \row \li - \b {Anti-Aliased Painting} - - When drawing, the pixel rendering is controlled by the - QPainter::Antialiasing render hint. The QPainter::RenderHint enum - is used to specify flags to QPainter that may or may not be - respected by any given engine. - - The QPainter::Antialiasing value indicates that the engine should - antialias edges of primitives if possible, i.e. smoothing the - edges by using different color intensities. - - \li \image paintsystem-antialiasing.png - - \endtable - - \section1 Filling - - Shapes are filled using the QBrush class. A brush is defined - by its color and its style (i.e. its fill pattern). - - Any color in Qt is represented by the QColor class which supports - the RGB, HSV and CMYK color models. QColor also support - alpha-blended outlining and filling (specifying the transparency - effect), and the class is platform and device independent (the - colors are mapped to hardware using the QColormap class). For more - information, see the QColor class documentation. - - When creating a new widget, it is recommend to use the colors in - the widget's palette rather than hard-coding specific colors. All - widgets in Qt contain a palette and use their palette to draw - themselves. A widget's palette is represented by the QPalette - class which contains color groups for each widget state. - - The available fill patterns are described by the Qt::BrushStyle - enum. These include basic patterns spanning from uniform color to - very sparse pattern, various line combinations, gradient fills and - textures. Qt provides the QGradient class to define custom - gradient fills, while texture patterns are specified using the - QPixmap class. - - \table 100% - \row - \li \image paintsystem-fancygradient.png - \li \b QGradient - - The QGradient class is used in combination with QBrush to specify - gradient fills. - - \image paintsystem-gradients.png - - Qt currently supports three types of gradient fills: Linear - gradients interpolate colors between start and end points, radial - gradients interpolate colors between a focal point and end points - on a circle surrounding it, and conical gradients interpolate - colors around a center point. - - \endtable -*/ - -/*! - \page paintsystem-images.html - \title Reading and Writing Image Files - - \previouspage Coordinate System - \contentspage The Paint System - \nextpage Styling - - The most common way to read images is through QImage and QPixmap's - constructors, or by calling the QImage::load() and QPixmap::load() - functions. In addition, Qt provides the QImageReader class which - gives more control over the process. Depending on the underlying - support in the image format, the functions provided by the class - can save memory and speed up loading of images. - - Likewise, Qt provides the QImageWriter class which supports - setting format specific options, such as the gamma level, - compression level and quality, prior to storing the image. If you - do not need such options, you can use QImage::save() or - QPixmap::save() instead. - - \table 100% - \row - \li \b QMovie - - QMovie is a convenience class for displaying animations, using the - QImageReader class internally. Once created, the QMovie class - provides various functions for both running and controlling the - given animation. - - \li \image paintsystem-movie.png - \endtable - - The QImageReader and QImageWriter classes rely on the - QImageIOHandler class which is the common image I/O interface for - all image formats in Qt. QImageIOHandler objects are used - internally by QImageReader and QImageWriter to add support for - different image formats to Qt. - - A list of the supported file formats are available through the - QImageReader::supportedImageFormats() and - QImageWriter::supportedImageFormats() functions. Qt supports - several file formats by default, and in addition new formats can - be added as plugins. The currently supported formats are listed in - the QImageReader and QImageWriter class documentation. - - Qt's plugin mechanism can also be used to write a custom image - format handler. This is done by deriving from the QImageIOHandler - class, and creating a QImageIOPlugin object which is a factory for - creating QImageIOHandler objects. When the plugin is installed, - QImageReader and QImageWriter will automatically load the plugin - and start using it. - - \section1 Rendering SVG files - - \table 100% - \row - \li \image paintsystem-svg.png - \li \b {SVG Rendering} - - Scalable Vector Graphics (SVG) is a language for describing two-dimensional - graphics and graphical applications in XML. SVG 1.1 is a W3C Recommendation - and forms the core of the current SVG developments in Qt. SVG 1.2 is the - specification currently being developed by the \l{SVG Working Group}, and it - is \l{http://www.w3.org/TR/SVG12/}{available in draft form}. - The \l{Mobile SVG Profiles} (SVG Basic and SVG Tiny) are aimed at - resource-limited devices and are part of the 3GPP platform for third generation - mobile phones. You can read more about SVG at \l{About SVG}. - - Qt supports the \l{SVG 1.2 Tiny Static Features}{static features} of - \l{SVG 1.2 Tiny}. ECMA scripts and DOM manipulation are currently not - supported. - - SVG drawings can be rendered onto any QPaintDevice subclass. This - approach gives developers the flexibility to experiment, in order - to find the best solution for each application. - - The easiest way to render SVG files is to construct a QSvgWidget and - load an SVG file using one of the QSvgWidget::load() functions. - - QSvgRenderer is the class responsible for rendering SVG files for - QSvgWidget, and it can be used directly to provide SVG support for - custom widgets. - To load an SVG file, construct a QSvgRenderer with a file name or the - contents of a file, or call QSvgRenderer::load() on an existing - renderer. If the SVG file has been loaded successfully the - QSvgRenderer::isValid() will return true. - - Once you have loaded the SVG file successfully, you can render it - with the QSvgRenderer::render() function. Note that this scheme allows - you to render SVG files on all paint devices supported by Qt, including - QWidget, QGLWidget, and QImage. See the \l{SVG Viewer Example}{SVG Viewer} - example for more details. - - \endtable -*/ - -/*! - \page paintsystem-styling.html - \title Styling - - \previouspage Reading and Writing Image Files - \contentspage The Paint System - \nextpage Printing with Qt - - Qt's built-in widgets use the QStyle class to perform nearly all - of their drawing. QStyle is an abstract base class that - encapsulates the look and feel of a GUI, and can be used to make - the widgets look exactly like the equivalent native widgets or to - give the widgets a custom look. - - Qt provides a set of QStyle subclasses that emulate the native - look of the different platforms supported by Qt (QWindowsStyle, - QMacStyle, QMotifStyle, etc.). These styles are built into the - QtGui library, other styles can be made available using Qt's - plugin mechansim. - - Most functions for drawing style elements take four arguments: - - \list - \li an enum value specifying which graphical element to draw - \li a QStyleOption object specifying how and where to render that element - \li a QPainter object that should be used to draw the element - \li a QWidget object on which the drawing is performed (optional) - \endlist - - The style gets all the information it needs to render the - graphical element from the QStyleOption class. The widget is - passed as the last argument in case the style needs it to perform - special effects (such as animated default buttons on Mac OS X), - but it isn't mandatory. In fact, QStyle can be used to draw on any - paint device (not just widgets), in which case the widget argument - is a zero pointer. - - \image paintsystem-stylepainter.png - - The paint system also provides the QStylePainter class inheriting - from QPainter. QStylePainter is a convenience class for drawing - QStyle elements inside a widget, and extends QPainter with a set - of high-level drawing functions implemented on top of QStyle's - API. The advantage of using QStylePainter is that the parameter - lists get considerably shorter. - - \table 100% - \row - \li \inlineimage paintsystem-icon.png - \li \b QIcon - - The QIcon class provides scalable icons in different modes and states. - - QIcon can generate pixmaps reflecting an icon's state, mode and - size. These pixmaps are generated from the set of pixmaps - made available to the icon, and are used by Qt widgets to show an - icon representing a particular action. - - The rendering of a QIcon object is handled by the QIconEngine - class. Each icon has a corresponding icon engine that is - responsible for drawing the icon with a requested size, mode and - state. - - \endtable - - For more information about widget styling and appearance, see the - \l{Styles and Style Aware Widgets}. -*/ diff --git a/doc/src/gui/qtgui.qdoc b/doc/src/gui/qtgui.qdoc deleted file mode 100644 index bffe07889a..0000000000 --- a/doc/src/gui/qtgui.qdoc +++ /dev/null @@ -1,39 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** GNU Free Documentation License -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms -** and conditions contained in a signed written agreement between you -** and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \module QtGui - \title QtGui Module - \ingroup modules - - \brief The QtGui module extends QtCore with GUI functionality. - - To include the definitions of both modules' classes, use the - following directive: - - \snippet doc/src/snippets/code/doc_src_qtgui.pro 0 -*/ diff --git a/doc/src/images/brush-outline.png b/doc/src/images/brush-outline.png deleted file mode 100644 index f560c9faf5..0000000000 Binary files a/doc/src/images/brush-outline.png and /dev/null differ diff --git a/doc/src/images/coordinatesystem-analogclock.png b/doc/src/images/coordinatesystem-analogclock.png deleted file mode 100644 index 16e3091b77..0000000000 Binary files a/doc/src/images/coordinatesystem-analogclock.png and /dev/null differ diff --git a/doc/src/images/coordinatesystem-line-antialias.png b/doc/src/images/coordinatesystem-line-antialias.png deleted file mode 100644 index 90dfa8730e..0000000000 Binary files a/doc/src/images/coordinatesystem-line-antialias.png and /dev/null differ diff --git a/doc/src/images/coordinatesystem-line-raster.png b/doc/src/images/coordinatesystem-line-raster.png deleted file mode 100644 index 65201bde9f..0000000000 Binary files a/doc/src/images/coordinatesystem-line-raster.png and /dev/null differ diff --git a/doc/src/images/coordinatesystem-line.png b/doc/src/images/coordinatesystem-line.png deleted file mode 100644 index fbf6873084..0000000000 Binary files a/doc/src/images/coordinatesystem-line.png and /dev/null differ diff --git a/doc/src/images/coordinatesystem-rect-antialias.png b/doc/src/images/coordinatesystem-rect-antialias.png deleted file mode 100644 index 162e1df9cb..0000000000 Binary files a/doc/src/images/coordinatesystem-rect-antialias.png and /dev/null differ diff --git a/doc/src/images/coordinatesystem-rect-raster.png b/doc/src/images/coordinatesystem-rect-raster.png deleted file mode 100644 index be3690d6ad..0000000000 Binary files a/doc/src/images/coordinatesystem-rect-raster.png and /dev/null differ diff --git a/doc/src/images/coordinatesystem-rect.png b/doc/src/images/coordinatesystem-rect.png deleted file mode 100644 index 76c06befd6..0000000000 Binary files a/doc/src/images/coordinatesystem-rect.png and /dev/null differ diff --git a/doc/src/images/coordinatesystem-transformations.png b/doc/src/images/coordinatesystem-transformations.png deleted file mode 100644 index 2736213c07..0000000000 Binary files a/doc/src/images/coordinatesystem-transformations.png and /dev/null differ diff --git a/doc/src/images/hoverevents.png b/doc/src/images/hoverevents.png deleted file mode 100644 index ccc079bdf1..0000000000 Binary files a/doc/src/images/hoverevents.png and /dev/null differ diff --git a/doc/src/images/paintsystem-antialiasing.png b/doc/src/images/paintsystem-antialiasing.png deleted file mode 100644 index 1275841b93..0000000000 Binary files a/doc/src/images/paintsystem-antialiasing.png and /dev/null differ diff --git a/doc/src/images/paintsystem-core.png b/doc/src/images/paintsystem-core.png deleted file mode 100644 index 7d6a8e591b..0000000000 Binary files a/doc/src/images/paintsystem-core.png and /dev/null differ diff --git a/doc/src/images/paintsystem-devices.png b/doc/src/images/paintsystem-devices.png deleted file mode 100644 index 7b81b7cbb8..0000000000 Binary files a/doc/src/images/paintsystem-devices.png and /dev/null differ diff --git a/doc/src/images/paintsystem-fancygradient.png b/doc/src/images/paintsystem-fancygradient.png deleted file mode 100644 index 701df29e42..0000000000 Binary files a/doc/src/images/paintsystem-fancygradient.png and /dev/null differ diff --git a/doc/src/images/paintsystem-gradients.png b/doc/src/images/paintsystem-gradients.png deleted file mode 100644 index 50b2ed3671..0000000000 Binary files a/doc/src/images/paintsystem-gradients.png and /dev/null differ diff --git a/doc/src/images/paintsystem-icon.png b/doc/src/images/paintsystem-icon.png deleted file mode 100644 index 4623db0761..0000000000 Binary files a/doc/src/images/paintsystem-icon.png and /dev/null differ diff --git a/doc/src/images/paintsystem-movie.png b/doc/src/images/paintsystem-movie.png deleted file mode 100644 index 992ea9edd4..0000000000 Binary files a/doc/src/images/paintsystem-movie.png and /dev/null differ diff --git a/doc/src/images/paintsystem-painterpath.png b/doc/src/images/paintsystem-painterpath.png deleted file mode 100644 index f8154f2634..0000000000 Binary files a/doc/src/images/paintsystem-painterpath.png and /dev/null differ diff --git a/doc/src/images/paintsystem-stylepainter.png b/doc/src/images/paintsystem-stylepainter.png deleted file mode 100644 index a67c6c5afc..0000000000 Binary files a/doc/src/images/paintsystem-stylepainter.png and /dev/null differ diff --git a/doc/src/images/paintsystem-svg.png b/doc/src/images/paintsystem-svg.png deleted file mode 100644 index ecc8ef8f97..0000000000 Binary files a/doc/src/images/paintsystem-svg.png and /dev/null differ diff --git a/doc/src/images/qcolor-cmyk.png b/doc/src/images/qcolor-cmyk.png deleted file mode 100644 index dfe8f67a31..0000000000 Binary files a/doc/src/images/qcolor-cmyk.png and /dev/null differ diff --git a/doc/src/images/qcolor-hsv.png b/doc/src/images/qcolor-hsv.png deleted file mode 100644 index 49fdf77222..0000000000 Binary files a/doc/src/images/qcolor-hsv.png and /dev/null differ diff --git a/doc/src/images/qcolor-hue.png b/doc/src/images/qcolor-hue.png deleted file mode 100644 index 144b27c87a..0000000000 Binary files a/doc/src/images/qcolor-hue.png and /dev/null differ diff --git a/doc/src/images/qcolor-rgb.png b/doc/src/images/qcolor-rgb.png deleted file mode 100644 index fea4c63fd7..0000000000 Binary files a/doc/src/images/qcolor-rgb.png and /dev/null differ diff --git a/doc/src/images/qcolor-saturation.png b/doc/src/images/qcolor-saturation.png deleted file mode 100644 index f28776aff5..0000000000 Binary files a/doc/src/images/qcolor-saturation.png and /dev/null differ diff --git a/doc/src/images/qcolor-value.png b/doc/src/images/qcolor-value.png deleted file mode 100644 index 0e069123a9..0000000000 Binary files a/doc/src/images/qcolor-value.png and /dev/null differ diff --git a/doc/src/images/qconicalgradient.png b/doc/src/images/qconicalgradient.png deleted file mode 100644 index 82603066fb..0000000000 Binary files a/doc/src/images/qconicalgradient.png and /dev/null differ diff --git a/doc/src/images/qgradient-conical.png b/doc/src/images/qgradient-conical.png deleted file mode 100644 index cf06b70db6..0000000000 Binary files a/doc/src/images/qgradient-conical.png and /dev/null differ diff --git a/doc/src/images/qgradient-linear.png b/doc/src/images/qgradient-linear.png deleted file mode 100644 index 5a5e880de7..0000000000 Binary files a/doc/src/images/qgradient-linear.png and /dev/null differ diff --git a/doc/src/images/qgradient-radial.png b/doc/src/images/qgradient-radial.png deleted file mode 100644 index 95b9e9c3c9..0000000000 Binary files a/doc/src/images/qgradient-radial.png and /dev/null differ diff --git a/doc/src/images/qimage-32bit_scaled.png b/doc/src/images/qimage-32bit_scaled.png deleted file mode 100644 index 6932327456..0000000000 Binary files a/doc/src/images/qimage-32bit_scaled.png and /dev/null differ diff --git a/doc/src/images/qimage-8bit_scaled.png b/doc/src/images/qimage-8bit_scaled.png deleted file mode 100644 index 7cbf0f1e29..0000000000 Binary files a/doc/src/images/qimage-8bit_scaled.png and /dev/null differ diff --git a/doc/src/images/qlineargradient-pad.png b/doc/src/images/qlineargradient-pad.png deleted file mode 100644 index d77eb3dc3d..0000000000 Binary files a/doc/src/images/qlineargradient-pad.png and /dev/null differ diff --git a/doc/src/images/qlineargradient-reflect.png b/doc/src/images/qlineargradient-reflect.png deleted file mode 100644 index dd12665051..0000000000 Binary files a/doc/src/images/qlineargradient-reflect.png and /dev/null differ diff --git a/doc/src/images/qlineargradient-repeat.png b/doc/src/images/qlineargradient-repeat.png deleted file mode 100644 index e38203c438..0000000000 Binary files a/doc/src/images/qlineargradient-repeat.png and /dev/null differ diff --git a/doc/src/images/qmatrix-combinedtransformation.png b/doc/src/images/qmatrix-combinedtransformation.png deleted file mode 100644 index f791bfa917..0000000000 Binary files a/doc/src/images/qmatrix-combinedtransformation.png and /dev/null differ diff --git a/doc/src/images/qmatrix-representation.png b/doc/src/images/qmatrix-representation.png deleted file mode 100644 index 2e3efd33fc..0000000000 Binary files a/doc/src/images/qmatrix-representation.png and /dev/null differ diff --git a/doc/src/images/qmatrix-simpletransformation.png b/doc/src/images/qmatrix-simpletransformation.png deleted file mode 100644 index dde8f4bc58..0000000000 Binary files a/doc/src/images/qmatrix-simpletransformation.png and /dev/null differ diff --git a/doc/src/images/qpainter-affinetransformations.png b/doc/src/images/qpainter-affinetransformations.png deleted file mode 100644 index fe2f9a072b..0000000000 Binary files a/doc/src/images/qpainter-affinetransformations.png and /dev/null differ diff --git a/doc/src/images/qpainter-arc.png b/doc/src/images/qpainter-arc.png deleted file mode 100644 index 8cb9cec96b..0000000000 Binary files a/doc/src/images/qpainter-arc.png and /dev/null differ diff --git a/doc/src/images/qpainter-basicdrawing.png b/doc/src/images/qpainter-basicdrawing.png deleted file mode 100644 index 3be48c8737..0000000000 Binary files a/doc/src/images/qpainter-basicdrawing.png and /dev/null differ diff --git a/doc/src/images/qpainter-chord.png b/doc/src/images/qpainter-chord.png deleted file mode 100644 index a8090861a0..0000000000 Binary files a/doc/src/images/qpainter-chord.png and /dev/null differ diff --git a/doc/src/images/qpainter-clock.png b/doc/src/images/qpainter-clock.png deleted file mode 100644 index 3634754161..0000000000 Binary files a/doc/src/images/qpainter-clock.png and /dev/null differ diff --git a/doc/src/images/qpainter-compositiondemo.png b/doc/src/images/qpainter-compositiondemo.png deleted file mode 100644 index 40f62c75be..0000000000 Binary files a/doc/src/images/qpainter-compositiondemo.png and /dev/null differ diff --git a/doc/src/images/qpainter-compositionmode1.png b/doc/src/images/qpainter-compositionmode1.png deleted file mode 100644 index 6753093521..0000000000 Binary files a/doc/src/images/qpainter-compositionmode1.png and /dev/null differ diff --git a/doc/src/images/qpainter-compositionmode2.png b/doc/src/images/qpainter-compositionmode2.png deleted file mode 100644 index fc05afbd8c..0000000000 Binary files a/doc/src/images/qpainter-compositionmode2.png and /dev/null differ diff --git a/doc/src/images/qpainter-concentriccircles.png b/doc/src/images/qpainter-concentriccircles.png deleted file mode 100644 index 4889dcd76d..0000000000 Binary files a/doc/src/images/qpainter-concentriccircles.png and /dev/null differ diff --git a/doc/src/images/qpainter-ellipse.png b/doc/src/images/qpainter-ellipse.png deleted file mode 100644 index e7e78c3dac..0000000000 Binary files a/doc/src/images/qpainter-ellipse.png and /dev/null differ diff --git a/doc/src/images/qpainter-gradients.png b/doc/src/images/qpainter-gradients.png deleted file mode 100644 index b7bc6a3270..0000000000 Binary files a/doc/src/images/qpainter-gradients.png and /dev/null differ diff --git a/doc/src/images/qpainter-line.png b/doc/src/images/qpainter-line.png deleted file mode 100644 index 5f1cd97eff..0000000000 Binary files a/doc/src/images/qpainter-line.png and /dev/null differ diff --git a/doc/src/images/qpainter-painterpaths.png b/doc/src/images/qpainter-painterpaths.png deleted file mode 100644 index 0762ca93f3..0000000000 Binary files a/doc/src/images/qpainter-painterpaths.png and /dev/null differ diff --git a/doc/src/images/qpainter-path.png b/doc/src/images/qpainter-path.png deleted file mode 100644 index 3570b16d7a..0000000000 Binary files a/doc/src/images/qpainter-path.png and /dev/null differ diff --git a/doc/src/images/qpainter-pathstroking.png b/doc/src/images/qpainter-pathstroking.png deleted file mode 100644 index ab73c6ae01..0000000000 Binary files a/doc/src/images/qpainter-pathstroking.png and /dev/null differ diff --git a/doc/src/images/qpainter-pie.png b/doc/src/images/qpainter-pie.png deleted file mode 100644 index 78039013e0..0000000000 Binary files a/doc/src/images/qpainter-pie.png and /dev/null differ diff --git a/doc/src/images/qpainter-polygon.png b/doc/src/images/qpainter-polygon.png deleted file mode 100644 index 3b6ea3c797..0000000000 Binary files a/doc/src/images/qpainter-polygon.png and /dev/null differ diff --git a/doc/src/images/qpainter-rectangle.png b/doc/src/images/qpainter-rectangle.png deleted file mode 100644 index 05fdc88300..0000000000 Binary files a/doc/src/images/qpainter-rectangle.png and /dev/null differ diff --git a/doc/src/images/qpainter-rotation.png b/doc/src/images/qpainter-rotation.png deleted file mode 100644 index 6e24a0e040..0000000000 Binary files a/doc/src/images/qpainter-rotation.png and /dev/null differ diff --git a/doc/src/images/qpainter-roundrect.png b/doc/src/images/qpainter-roundrect.png deleted file mode 100644 index 876a277811..0000000000 Binary files a/doc/src/images/qpainter-roundrect.png and /dev/null differ diff --git a/doc/src/images/qpainter-scale.png b/doc/src/images/qpainter-scale.png deleted file mode 100644 index 4fe582eb13..0000000000 Binary files a/doc/src/images/qpainter-scale.png and /dev/null differ diff --git a/doc/src/images/qpainter-text.png b/doc/src/images/qpainter-text.png deleted file mode 100644 index e95c965d7b..0000000000 Binary files a/doc/src/images/qpainter-text.png and /dev/null differ diff --git a/doc/src/images/qpainter-translation.png b/doc/src/images/qpainter-translation.png deleted file mode 100644 index b3716ca3f6..0000000000 Binary files a/doc/src/images/qpainter-translation.png and /dev/null differ diff --git a/doc/src/images/qpainter-vectordeformation.png b/doc/src/images/qpainter-vectordeformation.png deleted file mode 100644 index aff95f404c..0000000000 Binary files a/doc/src/images/qpainter-vectordeformation.png and /dev/null differ diff --git a/doc/src/images/qpainterpath-addellipse.png b/doc/src/images/qpainterpath-addellipse.png deleted file mode 100644 index 98f85174ef..0000000000 Binary files a/doc/src/images/qpainterpath-addellipse.png and /dev/null differ diff --git a/doc/src/images/qpainterpath-addpolygon.png b/doc/src/images/qpainterpath-addpolygon.png deleted file mode 100644 index d36bde8ada..0000000000 Binary files a/doc/src/images/qpainterpath-addpolygon.png and /dev/null differ diff --git a/doc/src/images/qpainterpath-addrectangle.png b/doc/src/images/qpainterpath-addrectangle.png deleted file mode 100644 index be9283e46d..0000000000 Binary files a/doc/src/images/qpainterpath-addrectangle.png and /dev/null differ diff --git a/doc/src/images/qpainterpath-addtext.png b/doc/src/images/qpainterpath-addtext.png deleted file mode 100644 index 803a9581ac..0000000000 Binary files a/doc/src/images/qpainterpath-addtext.png and /dev/null differ diff --git a/doc/src/images/qpainterpath-arcto.png b/doc/src/images/qpainterpath-arcto.png deleted file mode 100644 index fe60b08d31..0000000000 Binary files a/doc/src/images/qpainterpath-arcto.png and /dev/null differ diff --git a/doc/src/images/qpainterpath-construction.png b/doc/src/images/qpainterpath-construction.png deleted file mode 100644 index 4beeba1dd8..0000000000 Binary files a/doc/src/images/qpainterpath-construction.png and /dev/null differ diff --git a/doc/src/images/qpainterpath-cubicto.png b/doc/src/images/qpainterpath-cubicto.png deleted file mode 100644 index 465bfeca29..0000000000 Binary files a/doc/src/images/qpainterpath-cubicto.png and /dev/null differ diff --git a/doc/src/images/qpainterpath-demo.png b/doc/src/images/qpainterpath-demo.png deleted file mode 100644 index ceeed2f170..0000000000 Binary files a/doc/src/images/qpainterpath-demo.png and /dev/null differ diff --git a/doc/src/images/qpainterpath-example.png b/doc/src/images/qpainterpath-example.png deleted file mode 100644 index f2bd359aba..0000000000 Binary files a/doc/src/images/qpainterpath-example.png and /dev/null differ diff --git a/doc/src/images/qpen-dashpattern.png b/doc/src/images/qpen-dashpattern.png deleted file mode 100644 index e33cf58d49..0000000000 Binary files a/doc/src/images/qpen-dashpattern.png and /dev/null differ diff --git a/doc/src/images/qpen-demo.png b/doc/src/images/qpen-demo.png deleted file mode 100644 index 3ea5108802..0000000000 Binary files a/doc/src/images/qpen-demo.png and /dev/null differ diff --git a/doc/src/images/qpen-miterlimit.png b/doc/src/images/qpen-miterlimit.png deleted file mode 100644 index 17a90725fb..0000000000 Binary files a/doc/src/images/qpen-miterlimit.png and /dev/null differ diff --git a/doc/src/images/qradialgradient-pad.png b/doc/src/images/qradialgradient-pad.png deleted file mode 100644 index 6c1a6cb268..0000000000 Binary files a/doc/src/images/qradialgradient-pad.png and /dev/null differ diff --git a/doc/src/images/qradialgradient-reflect.png b/doc/src/images/qradialgradient-reflect.png deleted file mode 100644 index 5122b180b1..0000000000 Binary files a/doc/src/images/qradialgradient-reflect.png and /dev/null differ diff --git a/doc/src/images/qradialgradient-repeat.png b/doc/src/images/qradialgradient-repeat.png deleted file mode 100644 index aa639b7779..0000000000 Binary files a/doc/src/images/qradialgradient-repeat.png and /dev/null differ diff --git a/doc/src/images/qstatustipevent-action.png b/doc/src/images/qstatustipevent-action.png deleted file mode 100644 index c5dcfd25f5..0000000000 Binary files a/doc/src/images/qstatustipevent-action.png and /dev/null differ diff --git a/doc/src/images/qstatustipevent-widget.png b/doc/src/images/qstatustipevent-widget.png deleted file mode 100644 index 3cc0a1f01b..0000000000 Binary files a/doc/src/images/qstatustipevent-widget.png and /dev/null differ diff --git a/doc/src/images/qt-fillrule-oddeven.png b/doc/src/images/qt-fillrule-oddeven.png deleted file mode 100644 index f39d1056f5..0000000000 Binary files a/doc/src/images/qt-fillrule-oddeven.png and /dev/null differ diff --git a/doc/src/images/qt-fillrule-winding.png b/doc/src/images/qt-fillrule-winding.png deleted file mode 100644 index 8018248331..0000000000 Binary files a/doc/src/images/qt-fillrule-winding.png and /dev/null differ diff --git a/doc/src/images/qtexttableformat-cell.png b/doc/src/images/qtexttableformat-cell.png deleted file mode 100644 index bbf85ffe46..0000000000 Binary files a/doc/src/images/qtexttableformat-cell.png and /dev/null differ diff --git a/doc/src/images/qtransform-combinedtransformation.png b/doc/src/images/qtransform-combinedtransformation.png deleted file mode 100644 index df1e226746..0000000000 Binary files a/doc/src/images/qtransform-combinedtransformation.png and /dev/null differ diff --git a/doc/src/images/qtransform-combinedtransformation2.png b/doc/src/images/qtransform-combinedtransformation2.png deleted file mode 100644 index c037a0d565..0000000000 Binary files a/doc/src/images/qtransform-combinedtransformation2.png and /dev/null differ diff --git a/doc/src/images/qtransform-representation.png b/doc/src/images/qtransform-representation.png deleted file mode 100644 index 883d5dc487..0000000000 Binary files a/doc/src/images/qtransform-representation.png and /dev/null differ diff --git a/doc/src/images/qtransform-simpletransformation.png b/doc/src/images/qtransform-simpletransformation.png deleted file mode 100644 index 743e4e3e07..0000000000 Binary files a/doc/src/images/qtransform-simpletransformation.png and /dev/null differ diff --git a/doc/src/images/texttable-merge.png b/doc/src/images/texttable-merge.png deleted file mode 100644 index 3b32239a42..0000000000 Binary files a/doc/src/images/texttable-merge.png and /dev/null differ diff --git a/doc/src/images/texttable-split.png b/doc/src/images/texttable-split.png deleted file mode 100644 index 2fa17b85a3..0000000000 Binary files a/doc/src/images/texttable-split.png and /dev/null differ diff --git a/doc/src/snippets/brush/brush.cpp b/doc/src/snippets/brush/brush.cpp deleted file mode 100644 index a92223ee93..0000000000 --- a/doc/src/snippets/brush/brush.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -int main() -{ - QWidget anyPaintDevice; - { - // PEN SNIPPET - QPainter painter; - QPen pen(Qt::red, 2); // red solid line, 2 pixels wide - painter.begin(&anyPaintDevice); // paint something - painter.setPen(pen); // set the red, wide pen - painter.drawRect(40,30, 200,100); // draw a rectangle - painter.setPen(Qt::blue); // set blue pen, 0 pixel width - painter.drawLine(40,30, 240,130); // draw a diagonal in rectangle - painter.end(); // painting done - } - - { - // BRUSH SNIPPET - QPainter painter; - QBrush brush(Qt::yellow); // yellow solid pattern - painter.begin(&anyPaintDevice); // paint something - painter.setBrush(brush); // set the yellow brush - painter.setPen(Qt::NoPen); // do not draw outline - painter.drawRect(40,30, 200,100); // draw filled rectangle - painter.setBrush(Qt::NoBrush); // do not fill - painter.setPen(Qt::black); // set black pen, 0 pixel width - painter.drawRect(10,10, 30,20); // draw rectangle outline - painter.end(); // painting done - } - - // LINEAR -//! [0] - QLinearGradient linearGrad(QPointF(100, 100), QPointF(200, 200)); - linearGrad.setColorAt(0, Qt::black); - linearGrad.setColorAt(1, Qt::white); -//! [0] - - // RADIAL -//! [1] - QRadialGradient radialGrad(QPointF(100, 100), 100); - radialGrad.setColorAt(0, Qt::red); - radialGrad.setColorAt(0.5, Qt::blue); - radialGrad.setColorAt(1, Qt::green); -//! [1] -} diff --git a/doc/src/snippets/brush/gradientcreationsnippet.cpp b/doc/src/snippets/brush/gradientcreationsnippet.cpp deleted file mode 100644 index 9ec8c3f07a..0000000000 --- a/doc/src/snippets/brush/gradientcreationsnippet.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -int main(int argv, char **args) -{ - QApplication app(argv, args); - -//! [0] - QRadialGradient gradient(50, 50, 50, 50, 50); - gradient.setColorAt(0, QColor::fromRgbF(0, 1, 0, 1)); - gradient.setColorAt(1, QColor::fromRgbF(0, 0, 0, 0)); - - QBrush brush(gradient); -//! [0] - - QWidget widget; - QPalette palette; - palette.setBrush(widget.backgroundRole(), brush); - widget.setPalette(palette); - widget.show(); - - return app.exec(); -} diff --git a/doc/src/snippets/code/doc_src_qtgui.pro b/doc/src/snippets/code/doc_src_qtgui.pro deleted file mode 100644 index 51bb6c74ff..0000000000 --- a/doc/src/snippets/code/doc_src_qtgui.pro +++ /dev/null @@ -1,3 +0,0 @@ -#! [0] -#include -#! [0] diff --git a/doc/src/snippets/code/src.gui.text.qtextdocumentwriter.cpp b/doc/src/snippets/code/src.gui.text.qtextdocumentwriter.cpp deleted file mode 100644 index 59ef46c422..0000000000 --- a/doc/src/snippets/code/src.gui.text.qtextdocumentwriter.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] - QTextDocumentWriter writer; - writer.setFormat("odf"); // same as writer.setFormat("ODF"); -//! [0] - diff --git a/doc/src/snippets/code/src_gui_accessible_qaccessible.cpp b/doc/src/snippets/code/src_gui_accessible_qaccessible.cpp deleted file mode 100644 index f12f55051e..0000000000 --- a/doc/src/snippets/code/src_gui_accessible_qaccessible.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [1] -typedef QAccessibleInterface* myFactoryFunction(const QString &key, QObject *); -//! [1] diff --git a/doc/src/snippets/code/src_gui_image_qimage.cpp b/doc/src/snippets/code/src_gui_image_qimage.cpp deleted file mode 100644 index 0c39e22eb6..0000000000 --- a/doc/src/snippets/code/src_gui_image_qimage.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QImage image(3, 3, QImage::Format_RGB32); -QRgb value; - -value = qRgb(189, 149, 39); // 0xffbd9527 -image.setPixel(1, 1, value); - -value = qRgb(122, 163, 39); // 0xff7aa327 -image.setPixel(0, 1, value); -image.setPixel(1, 0, value); - -value = qRgb(237, 187, 51); // 0xffedba31 -image.setPixel(2, 1, value); -//! [0] - - -//! [1] -QImage image(3, 3, QImage::Format_Indexed8); -QRgb value; - -value = qRgb(122, 163, 39); // 0xff7aa327 -image.setColor(0, value); - -value = qRgb(237, 187, 51); // 0xffedba31 -image.setColor(1, value); - -value = qRgb(189, 149, 39); // 0xffbd9527 -image.setColor(2, value); - -image.setPixel(0, 1, 0); -image.setPixel(1, 0, 0); -image.setPixel(1, 1, 2); -image.setPixel(2, 1, 1); -//! [1] - - -//! [2] -static const char * const start_xpm[] = { - "16 15 8 1", - "a c #cec6bd", -.... -//! [2] diff --git a/doc/src/snippets/code/src_gui_image_qimagereader.cpp b/doc/src/snippets/code/src_gui_image_qimagereader.cpp deleted file mode 100644 index 92f528e6c0..0000000000 --- a/doc/src/snippets/code/src_gui_image_qimagereader.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QImageReader reader; -reader.setFormat("png"); // same as reader.setFormat("PNG"); -//! [0] - - -//! [1] -QImageReader reader("image.png"); -// reader.format() == "png" -//! [1] - - -//! [2] -QImage icon(64, 64, QImage::Format_RGB32); -QImageReader reader("icon_64x64.bmp"); -if (reader.read(&icon)) { - // Display icon -} -//! [2] - - -//! [3] -QImageReader reader(":/image.png"); -if (reader.supportsOption(QImageIOHandler::Size)) - qDebug() << "Size:" << reader.size(); -//! [3] diff --git a/doc/src/snippets/code/src_gui_image_qimagewriter.cpp b/doc/src/snippets/code/src_gui_image_qimagewriter.cpp deleted file mode 100644 index d0f11929d3..0000000000 --- a/doc/src/snippets/code/src_gui_image_qimagewriter.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QImageWriter writer; -writer.setFormat("png"); // same as writer.setFormat("PNG"); -//! [0] - - -//! [1] -QImage image("some/image.jpeg"); -QImageWriter writer("images/outimage.png", "png"); -writer.setText("Author", "John Smith"); -writer.write(image); -//! [1] - - -//! [2] -QImageWriter writer(fileName); -if (writer.supportsOption(QImageIOHandler::Description)) - writer.setText("Author", "John Smith"); -//! [2] diff --git a/doc/src/snippets/code/src_gui_image_qmovie.cpp b/doc/src/snippets/code/src_gui_image_qmovie.cpp deleted file mode 100644 index 5d57d19204..0000000000 --- a/doc/src/snippets/code/src_gui_image_qmovie.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QLabel label; -QMovie *movie = new QMovie("animations/fire.gif"); - -label.setMovie(movie); -movie->start(); -//! [0] - - -//! [1] -QMovie movie("racecar.gif"); -movie.setSpeed(200); // 2x speed -//! [1] diff --git a/doc/src/snippets/code/src_gui_image_qpixmap.cpp b/doc/src/snippets/code/src_gui_image_qpixmap.cpp deleted file mode 100644 index b8c0fcfbd5..0000000000 --- a/doc/src/snippets/code/src_gui_image_qpixmap.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -static const char * const start_xpm[]={ - "16 15 8 1", - "a c #cec6bd", -.... -//! [0] - - -//! [1] -QPixmap myPixmap; -myPixmap->setMask(myPixmap->createHeuristicMask()); -//! [1] - -//! [2] -QPixmap pixmap("background.png"); -QRegion exposed; -pixmap.scroll(10, 10, pixmap.rect(), &exposed); -//! [2] diff --git a/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp b/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp deleted file mode 100644 index 9d42f6b330..0000000000 --- a/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QPixmap* pp; -QPixmap p; -if ((pp=QPixmapCache::find("my_big_image", pm))) { - p = *pp; -} else { - p.load("bigimage.png"); - QPixmapCache::insert("my_big_image", new QPixmap(p)); -} -painter->drawPixmap(0, 0, p); -//! [0] - - -//! [1] -QPixmap pm; -if (!QPixmapCache::find("my_big_image", &pm)) { - pm.load("bigimage.png"); - QPixmapCache::insert("my_big_image", pm); -} -painter->drawPixmap(0, 0, pm); -//! [1] diff --git a/doc/src/snippets/code/src_gui_kernel_qapplication.cpp b/doc/src/snippets/code/src_gui_kernel_qapplication.cpp deleted file mode 100644 index b32e8c3f39..0000000000 --- a/doc/src/snippets/code/src_gui_kernel_qapplication.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -int main(int argc, char **argv) -{ -#ifdef Q_WS_X11 - bool useGUI = getenv("DISPLAY") != 0; -#else - bool useGUI = true; -#endif - QApplication app(argc, argv, useGUI); - - if (useGUI) { - // start GUI version - ... - } else { - // start non-GUI version - ... - } - return app.exec(); -} -//! [0] - - -//! [1] -QApplication::setStyle(new QWindowsStyle); -//! [1] - - -//! [2] -int main(int argc, char *argv[]) -{ - QApplication::setColorSpec(QApplication::ManyColor); - QApplication app(argc, argv); - ... - return app.exec(); -} -//! [2] - - -//! [3] -QSize MyWidget::sizeHint() const -{ - return QSize(80, 25).expandedTo(QApplication::globalStrut()); -} -//! [3] - - -//! [4] -void showAllHiddenTopLevelWidgets() -{ - foreach (QWidget *widget, QApplication::topLevelWidgets()) { - if (widget->isHidden()) - widget->show(); - } -} -//! [4] - - -//! [5] -void updateAllWidgets() -{ - foreach (QWidget *widget, QApplication::allWidgets()) - widget->update(); -} -//! [5] - - -//! [6] -int main(int argc, char *argv[]) -{ - QApplication::setDesktopSettingsAware(false); - QApplication app(argc, argv); - ... - return app.exec(); -} -//! [6] - - -//! [7] -if ((startPos - currentPos).manhattanLength() >= - QApplication::startDragDistance()) - startTheDrag(); -//! [7] - - -//! [8] -void MyApplication::commitData(QSessionManager& manager) -{ - if (manager.allowsInteraction()) { - int ret = QMessageBox::warning( - mainWindow, - tr("My Application"), - tr("Save changes to document?"), - QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - - switch (ret) { - case QMessageBox::Save: - manager.release(); - if (!saveDocument()) - manager.cancel(); - break; - case QMessageBox::Discard: - break; - case QMessageBox::Cancel: - default: - manager.cancel(); - } - } else { - // we did not get permission to interact, then - // do something reasonable instead - } -} -//! [8] - - -//! [9] -appname -session id -//! [9] - - -//! [10] -foreach (const QString &command, mySession.restartCommand()) - do_something(command); -//! [10] - - -//! [11] -foreach (const QString &command, mySession.discardCommand()) - do_something(command); -//! [11] - - -//! [12] -QWidget *widget = qApp->widgetAt(x, y); -if (widget) - widget = widget->window(); -//! [12] - - -//! [13] -QWidget *widget = qApp->widgetAt(point); -if (widget) - widget = widget->window(); -//! [13] diff --git a/doc/src/snippets/code/src_gui_kernel_qapplication_x11.cpp b/doc/src/snippets/code/src_gui_kernel_qapplication_x11.cpp deleted file mode 100644 index 1d37765e3c..0000000000 --- a/doc/src/snippets/code/src_gui_kernel_qapplication_x11.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); -calculateHugeMandelbrot(); // lunch time... -QApplication::restoreOverrideCursor(); -//! [0] diff --git a/doc/src/snippets/code/src_gui_kernel_qclipboard.cpp b/doc/src/snippets/code/src_gui_kernel_qclipboard.cpp deleted file mode 100644 index 4cf8f33c02..0000000000 --- a/doc/src/snippets/code/src_gui_kernel_qclipboard.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QClipboard *clipboard = QApplication::clipboard(); -QString originalText = clipboard->text(); -... -clipboard->setText(newText); -//! [0] - - -//! [1] -QMimeData *data = new QMimeData; -data->setImageData(image); -clipboard->setMimeData(data, mode); -//! [1] diff --git a/doc/src/snippets/code/src_gui_kernel_qevent.cpp b/doc/src/snippets/code/src_gui_kernel_qevent.cpp deleted file mode 100644 index d8bdeebe84..0000000000 --- a/doc/src/snippets/code/src_gui_kernel_qevent.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -void MyWidget::wheelEvent(QWheelEvent *event) -{ - QPoint numPixels = envent->pixelDelta(); - QPoint numDegrees = envent->angleDelta() / 8; - - if (!numPixels.isNull()) { - scrollWithPixels(numpixels); - } else if (!numDegrees.isNull()) { - QPoint numSteps = numDegrees / 15; - scrollWithDegrees(numSteps); - } - - event->accept(); -} -//! [0] diff --git a/doc/src/snippets/code/src_gui_kernel_qkeysequence.cpp b/doc/src/snippets/code/src_gui_kernel_qkeysequence.cpp deleted file mode 100644 index 79dc967cf3..0000000000 --- a/doc/src/snippets/code/src_gui_kernel_qkeysequence.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QKeySequence(QKeySequence::Print); -QKeySequence(tr("Ctrl+P")); -QKeySequence(tr("Ctrl+p")); -QKeySequence(Qt::CTRL + Qt::Key_P); -//! [0] - - -//! [1] -QKeySequence(tr("Ctrl+X, Ctrl+C")); -QKeySequence(Qt::CTRL + Qt::Key_X, Qt::CTRL + Qt::Key_C); -//! [1] - - -//! [2] -QMenu *file = new QMenu(this); -file->addAction(tr("&Open..."), this, SLOT(open()), - QKeySequence(tr("Ctrl+O", "File|Open"))); -//! [2] diff --git a/doc/src/snippets/code/src_gui_kernel_qshortcutmap.cpp b/doc/src/snippets/code/src_gui_kernel_qshortcutmap.cpp deleted file mode 100644 index d761e31d3d..0000000000 --- a/doc/src/snippets/code/src_gui_kernel_qshortcutmap.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -key = QKeySequence(); -//! [0] diff --git a/doc/src/snippets/code/src_gui_painting_qbrush.cpp b/doc/src/snippets/code/src_gui_painting_qbrush.cpp deleted file mode 100644 index 8678c48d62..0000000000 --- a/doc/src/snippets/code/src_gui_painting_qbrush.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QPainter painter(this); - -painter.setBrush(Qt::cyan); -painter.setPen(Qt::darkCyan); -painter.drawRect(0, 0, 100,100); - -painter.setBrush(Qt::NoBrush); -painter.setPen(Qt::darkGreen); -painter.drawRect(40, 40, 100, 100); -//! [0] diff --git a/doc/src/snippets/code/src_gui_painting_qcolor.cpp b/doc/src/snippets/code/src_gui_painting_qcolor.cpp deleted file mode 100644 index 8954fed604..0000000000 --- a/doc/src/snippets/code/src_gui_painting_qcolor.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -// Specify semi-transparent red -painter.setBrush(QColor(255, 0, 0, 127)); -painter.drawRect(0, 0, width()/2, height()); - -// Specify semi-transparent blue -painter.setBrush(QColor(0, 0, 255, 127)); -painter.drawRect(0, 0, width(), height()/2); -//! [0] diff --git a/doc/src/snippets/code/src_gui_painting_qmatrix.cpp b/doc/src/snippets/code/src_gui_painting_qmatrix.cpp deleted file mode 100644 index d4e1b57b3c..0000000000 --- a/doc/src/snippets/code/src_gui_painting_qmatrix.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -x' = m11*x + m21*y + dx -y' = m22*y + m12*x + dy -//! [0] - - -//! [1] -x' = m11*x + m21*y + dx -y' = m22*y + m12*x + dy -//! [1] - - -//! [2] -x' = m11*x + m21*y + dx -y' = m22*y + m12*x + dy -//! [2] - - -//! [3] -x' = m11*x + m21*y + dx -y' = m22*y + m12*x + dy -//! [3] diff --git a/doc/src/snippets/code/src_gui_painting_qpainter.cpp b/doc/src/snippets/code/src_gui_painting_qpainter.cpp deleted file mode 100644 index 8caffa46f4..0000000000 --- a/doc/src/snippets/code/src_gui_painting_qpainter.cpp +++ /dev/null @@ -1,259 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -void SimpleExampleWidget::paintEvent(QPaintEvent *) -{ - QPainter painter(this); - painter.setPen(Qt::blue); - painter.setFont(QFont("Arial", 30)); - painter.drawText(rect(), Qt::AlignCenter, "Qt"); -} -//! [0] - - -//! [1] -void MyWidget::paintEvent(QPaintEvent *) -{ - QPainter p; - p.begin(this); - p.drawLine(...); // drawing code - p.end(); -} -//! [1] - - -//! [2] -void MyWidget::paintEvent(QPaintEvent *) -{ - QPainter p(this); - p.drawLine(...); // drawing code -} -//! [2] - - -//! [3] -painter->begin(0); // impossible - paint device cannot be 0 - -QPixmap image(0, 0); -painter->begin(&image); // impossible - image.isNull() == true; - -painter->begin(myWidget); -painter2->begin(myWidget); // impossible - only one painter at a time -//! [3] - - -//! [4] -void QPainter::rotate(qreal angle) -{ - QMatrix matrix; - matrix.rotate(angle); - setWorldMatrix(matrix, true); -} -//! [4] - - -//! [5] -QPainterPath path; -path.moveTo(20, 80); -path.lineTo(20, 30); -path.cubicTo(80, 0, 50, 50, 80, 80); - -QPainter painter(this); -painter.drawPath(path); -//! [5] - - -//! [6] -QLineF line(10.0, 80.0, 90.0, 20.0); - -QPainter(this); -painter.drawLine(line); -//! [6] - - -//! [7] -QRectF rectangle(10.0, 20.0, 80.0, 60.0); - -QPainter painter(this); -painter.drawRect(rectangle); -//! [7] - - -//! [8] -QRectF rectangle(10.0, 20.0, 80.0, 60.0); - -QPainter painter(this); -painter.drawRoundedRect(rectangle, 20.0, 15.0); -//! [8] - - -//! [9] -QRectF rectangle(10.0, 20.0, 80.0, 60.0); - -QPainter painter(this); -painter.drawEllipse(rectangle); -//! [9] - - -//! [10] -QRectF rectangle(10.0, 20.0, 80.0, 60.0); -int startAngle = 30 * 16; -int spanAngle = 120 * 16; - -QPainter painter(this); -painter.drawArc(rectangle, startAngle, spanAngle); -//! [10] - - -//! [11] -QRectF rectangle(10.0, 20.0, 80.0, 60.0); -int startAngle = 30 * 16; -int spanAngle = 120 * 16; - -QPainter painter(this); -painter.drawPie(rectangle, startAngle, spanAngle); -//! [11] - - -//! [12] -QRectF rectangle(10.0, 20.0, 80.0, 60.0); -int startAngle = 30 * 16; -int spanAngle = 120 * 16; - -QPainter painter(this); -painter.drawChord(rect, startAngle, spanAngle); -//! [12] - - -//! [13] -static const QPointF points[3] = { - QPointF(10.0, 80.0), - QPointF(20.0, 10.0), - QPointF(80.0, 30.0), -}; - -QPainter painter(this); -painter.drawPolyline(points, 3); -//! [13] - - -//! [14] -static const QPointF points[4] = { - QPointF(10.0, 80.0), - QPointF(20.0, 10.0), - QPointF(80.0, 30.0), - QPointF(90.0, 70.0) -}; - -QPainter painter(this); -painter.drawPolygon(points, 4); -//! [14] - - -//! [15] -static const QPointF points[4] = { - QPointF(10.0, 80.0), - QPointF(20.0, 10.0), - QPointF(80.0, 30.0), - QPointF(90.0, 70.0) -}; - -QPainter painter(this); -painter.drawConvexPolygon(points, 4); -//! [15] - - -//! [16] -QRectF target(10.0, 20.0, 80.0, 60.0); -QRectF source(0.0, 0.0, 70.0, 40.0); -QPixmap pixmap(":myPixmap.png"); - -QPainter(this); -painter.drawPixmap(target, image, source); -//! [16] - - -//! [17] -QPainter painter(this); -painter.drawText(rect, Qt::AlignCenter, tr("Qt by\nNokia")); -//! [17] - - -//! [18] -QPicture picture; -QPointF point(10.0, 20.0) -picture.load("drawing.pic"); - -QPainter painter(this); -painter.drawPicture(0, 0, picture); -//! [18] - - -//! [19] -fillRect(rectangle, background()). -//! [19] - - -//! [20] -QRectF target(10.0, 20.0, 80.0, 60.0); -QRectF source(0.0, 0.0, 70.0, 40.0); -QImage image(":/images/myImage.png"); - -QPainter painter(this); -painter.drawImage(target, image, source); -//! [20] - - -//! [21] -QPainter painter(this); -painter.fillRect(0, 0, 128, 128, Qt::green); -painter.beginNativePainting(); - -glEnable(GL_SCISSOR_TEST); -glScissor(0, 0, 64, 64); - -glClearColor(1, 0, 0, 1); -glClear(GL_COLOR_BUFFER_BIT); - -glDisable(GL_SCISSOR_TEST); - -painter.endNativePainting(); -//! [21] diff --git a/doc/src/snippets/code/src_gui_painting_qpainterpath.cpp b/doc/src/snippets/code/src_gui_painting_qpainterpath.cpp deleted file mode 100644 index b23f8cea23..0000000000 --- a/doc/src/snippets/code/src_gui_painting_qpainterpath.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QPainterPath path; -path.addRect(20, 20, 60, 60); - -path.moveTo(0, 0); -path.cubicTo(99, 0, 50, 50, 99, 99); -path.cubicTo(0, 99, 50, 50, 0, 0); - -QPainter painter(this); -painter.fillRect(0, 0, 100, 100, Qt::white); -painter.setPen(QPen(QColor(79, 106, 25), 1, Qt::SolidLine, - Qt::FlatCap, Qt::MiterJoin)); -painter.setBrush(QColor(122, 163, 39)); - -painter.drawPath(path); -//! [0] - - -//! [1] -QLinearGradient myGradient; -QPen myPen; - -QPainterPath myPath; -myPath.cubicTo(c1, c2, endPoint); - -QPainter painter(this); -painter.setBrush(myGradient); -painter.setPen(myPen); -painter.drawPath(myPath); -//! [1] - - -//! [2] -QLinearGradient myGradient; -QPen myPen; - -QPointF center, startPoint; - -QPainterPath myPath; -myPath.moveTo(center); -myPath.arcTo(boundingRect, startAngle, - sweepLength); - -QPainter painter(this); -painter.setBrush(myGradient); -painter.setPen(myPen); -painter.drawPath(myPath); -//! [2] - - -//! [3] -QLinearGradient myGradient; -QPen myPen; -QRectF myRectangle; - -QPainterPath myPath; -myPath.addRect(myRectangle); - -QPainter painter(this); -painter.setBrush(myGradient); -painter.setPen(myPen); -painter.drawPath(myPath); -//! [3] - - -//! [4] -QLinearGradient myGradient; -QPen myPen; -QPolygonF myPolygon; - -QPainterPath myPath; -myPath.addPolygon(myPolygon); - -QPainter painter(this); -painter.setBrush(myGradient); -painter.setPen(myPen); -painter.drawPath(myPath); -//! [4] - - -//! [5] -QLinearGradient myGradient; -QPen myPen; -QRectF boundingRectangle; - -QPainterPath myPath; -myPath.addEllipse(boundingRectangle); - -QPainter painter(this); -painter.setBrush(myGradient); -painter.setPen(myPen); -painter.drawPath(myPath); -//! [5] - - -//! [6] -QLinearGradient myGradient; -QPen myPen; -QFont myFont; -QPointF baseline(x, y); - -QPainterPath myPath; -myPath.addText(baseline, myFont, tr("Qt")); - -QPainter painter(this); -painter.setBrush(myGradient); -painter.setPen(myPen); -painter.drawPath(myPath); -//! [6] diff --git a/doc/src/snippets/code/src_gui_painting_qpen.cpp b/doc/src/snippets/code/src_gui_painting_qpen.cpp deleted file mode 100644 index 4da729b88d..0000000000 --- a/doc/src/snippets/code/src_gui_painting_qpen.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QPainter painter(this); -QPen pen(Qt::green, 3, Qt::DashDotLine, Qt::RoundCap, Qt::RoundJoin); -painter.setPen(pen); -//! [0] - - -//! [1] -QPainter painter(this); -QPen pen; // creates a default pen - -pen.setStyle(Qt::DashDotLine); -pen.setWidth(3); -pen.setBrush(Qt::green); -pen.setCapStyle(Qt::RoundCap); -pen.setJoinStyle(Qt::RoundJoin); - -painter.setPen(pen); -//! [1] - - -//! [2] -QPen pen; -QVector dashes; -qreal space = 4; - -dashes << 1 << space << 3 << space << 9 << space - << 27 << space << 9 << space; - -pen.setDashPattern(dashes); -//! [2] - - -//! [3] -QPen pen; -QVector dashes; -qreal space = 4; -dashes << 1 << space << 3 << space << 9 << space - << 27 << space << 9 << space; -pen.setDashPattern(dashes); -//! [3] diff --git a/doc/src/snippets/code/src_gui_painting_qregion.cpp b/doc/src/snippets/code/src_gui_painting_qregion.cpp deleted file mode 100644 index 8f334c5695..0000000000 --- a/doc/src/snippets/code/src_gui_painting_qregion.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -void MyWidget::paintEvent(QPaintEvent *) -{ - QRegion r1(QRect(100, 100, 200, 80), // r1: elliptic region - QRegion::Ellipse); - QRegion r2(QRect(100, 120, 90, 30)); // r2: rectangular region - QRegion r3 = r1.intersected(r2); // r3: intersection - - QPainter painter(this); - painter.setClipRegion(r3); - ... // paint clipped graphics -} -//! [0] diff --git a/doc/src/snippets/code/src_gui_painting_qregion_unix.cpp b/doc/src/snippets/code/src_gui_painting_qregion_unix.cpp deleted file mode 100644 index 63b9de19d1..0000000000 --- a/doc/src/snippets/code/src_gui_painting_qregion_unix.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QRegion r1(10, 10, 20, 20); -r1.isEmpty(); // false - -QRegion r3; -r3.isEmpty(); // true - -QRegion r2(40, 40, 20, 20); -r3 = r1.intersected(r2); // r3: intersection of r1 and r2 -r3.isEmpty(); // true - -r3 = r1.united(r2); // r3: union of r1 and r2 -r3.isEmpty(); // false -//! [0] diff --git a/doc/src/snippets/code/src_gui_painting_qtransform.cpp b/doc/src/snippets/code/src_gui_painting_qtransform.cpp deleted file mode 100644 index f54e0a07ca..0000000000 --- a/doc/src/snippets/code/src_gui_painting_qtransform.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -x' = m11*x + m21*y + dx -y' = m22*y + m12*x + dy -if (is not affine) { - w' = m13*x + m23*y + m33 - x' /= w' - y' /= w' -} -//! [0] - - -//! [1] -x' = m11*x + m21*y + dx -y' = m22*y + m12*x + dy -if (is not affine) { - w' = m13*x + m23*y + m33 - x' /= w' - y' /= w' -} -//! [1] - - -//! [2] -x' = m11*x + m21*y + dx -y' = m22*y + m12*x + dy -if (is not affine) { - w' = m13*x + m23*y + m33 - x' /= w' - y' /= w' -} -//! [2] - - -//! [3] -x' = m11*x + m21*y + dx -y' = m22*y + m12*x + dy -if (is not affine) { - w' = m13*x + m23*y + m33 - x' /= w' - y' /= w' -} -//! [3] diff --git a/doc/src/snippets/code/src_gui_qopenglshaderprogram.cpp b/doc/src/snippets/code/src_gui_qopenglshaderprogram.cpp deleted file mode 100644 index 637527036f..0000000000 --- a/doc/src/snippets/code/src_gui_qopenglshaderprogram.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QOpenGLShader shader(QOpenGLShader::Vertex); -shader.compileSourceCode(code); - -QOpenGLShaderProgram program(context); -program.addShader(shader); -program.link(); - -program.bind(); -//! [0] - -//! [1] -program.addShaderFromSourceCode(QOpenGLShader::Vertex, - "attribute highp vec4 vertex;\n" - "uniform highp mat4 matrix;\n" - "void main(void)\n" - "{\n" - " gl_Position = matrix * vertex;\n" - "}"); -program.addShaderFromSourceCode(QOpenGLShader::Fragment, - "uniform mediump vec4 color;\n" - "void main(void)\n" - "{\n" - " gl_FragColor = color;\n" - "}"); -program.link(); -program.bind(); - -int vertexLocation = program.attributeLocation("vertex"); -int matrixLocation = program.uniformLocation("matrix"); -int colorLocation = program.uniformLocation("color"); -//! [1] - -//! [2] -static GLfloat const triangleVertices[] = { - 60.0f, 10.0f, 0.0f, - 110.0f, 110.0f, 0.0f, - 10.0f, 110.0f, 0.0f -}; - -QColor color(0, 255, 0, 255); - -QMatrix4x4 pmvMatrix; -pmvMatrix.ortho(rect()); - -program.enableAttributeArray(vertexLocation); -program.setAttributeArray(vertexLocation, triangleVertices, 3); -program.setUniformValue(matrixLocation, pmvMatrix); -program.setUniformValue(colorLocation, color); - -glDrawArrays(GL_TRIANGLES, 0, 3); - -program.disableAttributeArray(vertexLocation); -//! [2] diff --git a/doc/src/snippets/code/src_gui_text_qfont.cpp b/doc/src/snippets/code/src_gui_text_qfont.cpp deleted file mode 100644 index fab550cbc7..0000000000 --- a/doc/src/snippets/code/src_gui_text_qfont.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QFont serifFont("Times", 10, QFont::Bold); -QFont sansFont("Helvetica [Cronyx]", 12); -//! [0] - - -//! [1] -QFont f("Helvetica"); -//! [1] - - -//! [2] -QFont f("Helvetica [Cronyx]"); -//! [2] - - -//! [3] -QFontInfo info(f1); -QString family = info.family(); -//! [3] - - -//! [4] -QFontMetrics fm(f1); -int textWidthInPixels = fm.width("How many pixels wide is this text?"); -int textHeightInPixels = fm.height(); -//! [4] diff --git a/doc/src/snippets/code/src_gui_text_qfontmetrics.cpp b/doc/src/snippets/code/src_gui_text_qfontmetrics.cpp deleted file mode 100644 index b864b4ddcc..0000000000 --- a/doc/src/snippets/code/src_gui_text_qfontmetrics.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QFont font("times", 24); -QFontMetrics fm(font); -int pixelsWide = fm.width("What's the width of this text?"); -int pixelsHigh = fm.height(); -//! [0] - - -//! [1] -QFont font("times", 24); -QFontMetricsF fm(font); -qreal pixelsWide = fm.width("What's the width of this text?"); -qreal pixelsHigh = fm.height(); -//! [1] diff --git a/doc/src/snippets/code/src_gui_text_qsyntaxhighlighter.cpp b/doc/src/snippets/code/src_gui_text_qsyntaxhighlighter.cpp deleted file mode 100644 index 3fb6b35bb9..0000000000 --- a/doc/src/snippets/code/src_gui_text_qsyntaxhighlighter.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QTextEdit *editor = new QTextEdit; -MyHighlighter *highlighter = new MyHighlighter(editor->document()); -//! [0] - - -//! [1] -void MyHighlighter::highlightBlock(const QString &text) -{ - QTextCharFormat myClassFormat; - myClassFormat.setFontWeight(QFont::Bold); - myClassFormat.setForeground(Qt::darkMagenta); - QString pattern = "\\bMy[A-Za-z]+\\b"; - - QRegExp expression(pattern); - int index = text.indexOf(expression); - while (index >= 0) { - int length = expression.matchedLength(); - setFormat(index, length, myClassFormat); - index = text.indexOf(expression, index + length); - } -} -//! [1] - - -//! [2] -QTextCharFormat multiLineCommentFormat; -multiLineCommentFormat.setForeground(Qt::red); - -QRegExp startExpression("/\\*"); -QRegExp endExpression("\\*/"); - -setCurrentBlockState(0); - -int startIndex = 0; -if (previousBlockState() != 1) - startIndex = text.indexOf(startExpression); - -while (startIndex >= 0) { - int endIndex = text.indexOf(endExpression, startIndex); - int commentLength; - if (endIndex == -1) { - setCurrentBlockState(1); - commentLength = text.length() - startIndex; - } else { - commentLength = endIndex - startIndex - + endExpression.matchedLength(); - } - setFormat(startIndex, commentLength, multiLineCommentFormat); - startIndex = text.indexOf(startExpression, - startIndex + commentLength); -} -//! [2] - - -//! [3] -void MyHighlighter::highlightBlock(const QString &text) -{ - QTextCharFormat myClassFormat; - myClassFormat.setFontWeight(QFont::Bold); - myClassFormat.setForeground(Qt::darkMagenta); - QString pattern = "\\bMy[A-Za-z]+\\b"; - - QRegExp expression(pattern); - int index = text.indexOf(expression); - while (index >= 0) { - int length = expression.matchedLength(); - setFormat(index, length, myClassFormat); - index = text.indexOf(expression, index + length); - } - } -//! [3] - - -//! [4] -struct ParenthesisInfo -{ - QChar char; - int position; -}; - -struct BlockData : public QTextBlockUserData -{ - QVector parentheses; -}; -//! [4] diff --git a/doc/src/snippets/code/src_gui_text_qtextcursor.cpp b/doc/src/snippets/code/src_gui_text_qtextcursor.cpp deleted file mode 100644 index 7954f66cbd..0000000000 --- a/doc/src/snippets/code/src_gui_text_qtextcursor.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -cursor.clearSelection(); -cursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor); -cursor.insertText("Hello World"); -//! [0] - - -//! [1] -QImage img = ... -textDocument->addResource(QTextDocument::ImageResource, QUrl("myimage"), img); -cursor.insertImage("myimage"); -//! [1] - - -//! [2] -QTextCursor cursor(textDocument); -cursor.beginEditBlock(); -cursor.insertText("Hello"); -cursor.insertText("World"); -cursor.endEditBlock(); - -textDocument->undo(); -//! [2] - - -//! [3] -QTextCursor cursor(textDocument); -cursor.beginEditBlock(); -cursor.insertText("Hello"); -cursor.insertText("World"); -cursor.endEditBlock(); - -... - -cursor.joinPreviousEditBlock(); -cursor.insertText("Hey"); -cursor.endEditBlock(); - -textDocument->undo(); -//! [3] diff --git a/doc/src/snippets/code/src_gui_text_qtextdocument.cpp b/doc/src/snippets/code/src_gui_text_qtextdocument.cpp deleted file mode 100644 index 23ebf8b2d2..0000000000 --- a/doc/src/snippets/code/src_gui_text_qtextdocument.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -... -//! [0] diff --git a/doc/src/snippets/code/src_gui_text_qtextlayout.cpp b/doc/src/snippets/code/src_gui_text_qtextlayout.cpp deleted file mode 100644 index c8e1d2e010..0000000000 --- a/doc/src/snippets/code/src_gui_text_qtextlayout.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -int leading = fontMetrics.leading(); -qreal height = 0; -textLayout.beginLayout(); -while (1) { - QTextLine line = textLayout.createLine(); - if (!line.isValid()) - break; - - line.setLineWidth(lineWidth); - height += leading; - line.setPosition(QPointF(0, height)); - height += line.height(); -} -textLayout.endLayout(); -//! [0] - - -//! [1] -QPainter painter(this); -textLayout.draw(&painter, QPoint(0, 0)); -//! [1] diff --git a/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp b/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp deleted file mode 100644 index 0b4739841b..0000000000 --- a/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -class MyHelpHandler : public QObject -{ - Q_OBJECT -public: - ... -public slots: - void showHelp(const QUrl &url); -}; - -QDesktopServices::setUrlHandler("help", helpInstance, "showHelp"); -//! [0] - -//! [1] -mailto:user@foo.com?subject=Test&body=Just a test -//! [1] - -//! [2] -QDesktopServices::openUrl(QUrl("file:///C:/Documents and Settings/All Users/Desktop", QUrl::TolerantMode)); -//! [2] diff --git a/doc/src/snippets/code/src_gui_widgets_qvalidator.cpp b/doc/src/snippets/code/src_gui_widgets_qvalidator.cpp deleted file mode 100644 index 2f769c5860..0000000000 --- a/doc/src/snippets/code/src_gui_widgets_qvalidator.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QValidator *validator = new QIntValidator(100, 999, this); -QLineEdit *edit = new QLineEdit(this); - -// the edit lineedit will only accept integers between 100 and 999 -edit->setValidator(validator); -//! [0] - - -//! [1] -QString str; -int pos = 0; -QIntValidator v(100, 900, this); - -str = "1"; -v.validate(str, pos); // returns Intermediate -str = "012"; -v.validate(str, pos); // returns Intermediate - -str = "123"; -v.validate(str, pos); // returns Acceptable -str = "678"; -v.validate(str, pos); // returns Acceptable - -str = "999"; -v.validate(str, pos); // returns Intermediate - -str = "1234"; -v.validate(str, pos); // returns Invalid -str = "-123"; -v.validate(str, pos); // returns Invalid -str = "abc"; -v.validate(str, pos); // returns Invalid -str = "12cm"; -v.validate(str, pos); // returns Invalid -//! [1] - - -//! [2] -int pos = 0; - -s = "abc"; -v.validate(s, pos); // returns Invalid - -s = "5"; -v.validate(s, pos); // returns Intermediate - -s = "50"; -v.validate(s, pos); // returns Acceptable -//! [2] - - -//! [3] -// regexp: optional '-' followed by between 1 and 3 digits -QRegExp rx("-?\\d{1,3}"); -QValidator *validator = new QRegExpValidator(rx, this); - -QLineEdit *edit = new QLineEdit(this); -edit->setValidator(validator); -//! [3] - - -//! [4] -// integers 1 to 9999 -QRegExp rx("[1-9]\\d{0,3}"); -// the validator treats the regexp as "^[1-9]\\d{0,3}$" -QRegExpValidator v(rx, 0); -QString s; -int pos = 0; - -s = "0"; v.validate(s, pos); // returns Invalid -s = "12345"; v.validate(s, pos); // returns Invalid -s = "1"; v.validate(s, pos); // returns Acceptable - -rx.setPattern("\\S+"); // one or more non-whitespace characters -v.setRegExp(rx); -s = "myfile.txt"; v.validate(s, pos); // Returns Acceptable -s = "my file.txt"; v.validate(s, pos); // Returns Invalid - -// A, B or C followed by exactly five digits followed by W, X, Y or Z -rx.setPattern("[A-C]\\d{5}[W-Z]"); -v.setRegExp(rx); -s = "a12345Z"; v.validate(s, pos); // Returns Invalid -s = "A12345Z"; v.validate(s, pos); // Returns Acceptable -s = "B12"; v.validate(s, pos); // Returns Intermediate - -// match most 'readme' files -rx.setPattern("read\\S?me(\.(txt|asc|1st))?"); -rx.setCaseSensitive(false); -v.setRegExp(rx); -s = "readme"; v.validate(s, pos); // Returns Acceptable -s = "README.1ST"; v.validate(s, pos); // Returns Acceptable -s = "read me.txt"; v.validate(s, pos); // Returns Invalid -s = "readm"; v.validate(s, pos); // Returns Intermediate -//! [4] diff --git a/doc/src/snippets/dragging/mainwindow.cpp b/doc/src/snippets/dragging/mainwindow.cpp deleted file mode 100644 index 57f1abc22d..0000000000 --- a/doc/src/snippets/dragging/mainwindow.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "mainwindow.h" - -MainWindow::MainWindow(QWidget *parent) - : QMainWindow(parent) -{ - QFrame *centralFrame = new QFrame(this); - - QLabel *nameLabel = new QLabel(tr("Comment:"), centralFrame); - commentEdit = new QTextEdit(centralFrame); - QLabel *dragLabel = new QLabel(tr("

Drag the icon to a filer " - "window or the desktop background:

"), - centralFrame); - iconLabel = new QLabel(centralFrame); - iconPixmap.load(":/images/file.png"); - iconLabel->setPixmap(iconPixmap); - - QGridLayout *grid = new QGridLayout(centralFrame); - grid->addWidget(nameLabel, 0, 0); - grid->addWidget(commentEdit, 1, 0, 1, 2); - grid->addWidget(dragLabel, 2, 0); - grid->addWidget(iconLabel, 2, 1); - - statusBar(); - setCentralWidget(centralFrame); - setWindowTitle(tr("Dragging")); -} - -//! [0] -void MainWindow::mousePressEvent(QMouseEvent *event) -{ - if (event->button() == Qt::LeftButton - && iconLabel->geometry().contains(event->pos())) { - -//! [1] - QDrag *drag = new QDrag(this); - QMimeData *mimeData = new QMimeData; - - mimeData->setText(commentEdit->toPlainText()); - drag->setMimeData(mimeData); -//! [1] - drag->setPixmap(iconPixmap); - - Qt::DropAction dropAction = drag->exec(); -//! [0] - - QString actionText; - switch (dropAction) { - case Qt::CopyAction: - actionText = tr("The text was copied."); - break; - case Qt::MoveAction: - actionText = tr("The text was moved."); - break; - case Qt::LinkAction: - actionText = tr("The text was linked."); - break; - case Qt::IgnoreAction: - actionText = tr("The drag was ignored."); - break; - default: - actionText = tr("Unknown action."); - break; - } - statusBar()->showMessage(actionText); -//! [2] - } -} -//! [2] diff --git a/doc/src/snippets/droparea.cpp b/doc/src/snippets/droparea.cpp deleted file mode 100644 index 27d52d1b89..0000000000 --- a/doc/src/snippets/droparea.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "droparea.h" - -DropArea::DropArea(QWidget *parent) - : QLabel(parent) -{ - setMinimumSize(200, 200); - setFrameStyle(QFrame::Sunken | QFrame::StyledPanel); - setAlignment(Qt::AlignCenter); - setAcceptDrops(true); - setAutoFillBackground(true); - clear(); -} - -void DropArea::dragEnterEvent(QDragEnterEvent *event) -{ - setText(tr("")); - setBackgroundRole(QPalette::Highlight); - - event->acceptProposedAction(); - emit changed(event->mimeData()); -} - -void DropArea::dragMoveEvent(QDragMoveEvent *event) -{ - event->acceptProposedAction(); -} - -void DropArea::dropEvent(QDropEvent *event) -{ - const QMimeData *mimeData = event->mimeData(); - - if (mimeData->hasImage()) { - setPixmap(qvariant_cast(mimeData->imageData())); - } else if (mimeData->hasHtml()) { - setText(mimeData->html()); - setTextFormat(Qt::RichText); - } else if (mimeData->hasText()) { - setText(mimeData->text()); - setTextFormat(Qt::PlainText); - } else { - setText(tr("Cannot display data")); - } - - setBackgroundRole(QPalette::Dark); - event->acceptProposedAction(); -} - -//![0] -void DropArea::paste() -{ - const QClipboard *clipboard = QApplication::clipboard(); - const QMimeData *mimeData = clipboard->mimeData(); - - if (mimeData->hasImage()) { - setPixmap(qvariant_cast(mimeData->imageData())); - } else if (mimeData->hasHtml()) { - setText(mimeData->html()); - setTextFormat(Qt::RichText); - } else if (mimeData->hasText()) { - setText(mimeData->text()); - setTextFormat(Qt::PlainText); - } else { - setText(tr("Cannot display data")); - } -//![0] - - emit changed(mimeData); - setBackgroundRole(QPalette::Dark); - //event->acceptProposedAction(); -} - -void DropArea::dragLeaveEvent(QDragLeaveEvent *event) -{ - clear(); - event->accept(); -} - -void DropArea::clear() -{ - setText(tr("")); - setBackgroundRole(QPalette::Dark); - - emit changed(); -} - -QPixmap DropArea::extractPixmap(const QByteArray &data, const QString &format) -{ - QList imageFormats = QImageReader::supportedImageFormats(); - QPixmap pixmap; - - foreach (const QByteArray &imageFormat, imageFormats) { - if (format.mid(6) == QString(imageFormat)) { - pixmap.loadFromData(data, imageFormat); - break; - } - } - return pixmap; -} diff --git a/doc/src/snippets/image/image.cpp b/doc/src/snippets/image/image.cpp deleted file mode 100644 index 1dfe41f8cd..0000000000 --- a/doc/src/snippets/image/image.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -int main() -{ - int x, y; - { - // BIT ACCESS - QImage image; - // sets bit at (x, y) to 1 - if (image.format() == QImage::Format_MonoLSB) - image.scanLine(y)[x >> 3] |= 1 << (x & 7); - else - image.scanLine(y)[x >> 3] |= 1 << (7 - (x & 7)); - } - - { - // 8-BIT ACCESS - QImage image; - // set entry 19 in the color table to yellow - image.setColor(19, qRgb(255, 255, 0)); - - // set 8 bit pixel at (x,y) to value yellow (in color table) - image.scanLine(y)[x] = 19; - } - - { - // 32-BIT - QImage image; - // sets 32 bit pixel at (x,y) to yellow. - uint *ptr = reinterpret_cast(image.scanLine(y)) + x; - *ptr = qRgb(255, 255, 0); - } - - { - // SAVE -//! [0] - QImage image; - QByteArray ba; - QBuffer buffer(&ba); - buffer.open(QIODevice::WriteOnly); - image.save(&buffer, "PNG"); // writes image into ba in PNG format -//! [0] - } - - { - // PIX SAVE -//! [1] - QPixmap pixmap; - QByteArray bytes; - QBuffer buffer(&bytes); - buffer.open(QIODevice::WriteOnly); - pixmap.save(&buffer, "PNG"); // writes pixmap into bytes in PNG format -//! [1] - } - - { - // MASK -//! [2] - QPixmap alpha("image-with-alpha.png"); - QPixmap alphacopy = alpha; - alphacopy.setMask(alphacopy.mask()); -//! [2] - } -} diff --git a/doc/src/snippets/image/supportedformat.cpp b/doc/src/snippets/image/supportedformat.cpp deleted file mode 100644 index 6d481908e8..0000000000 --- a/doc/src/snippets/image/supportedformat.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -int main(int argv, char **args) -{ -//! [0] - QImageWriter writer; - writer.setFormat("png"); - if (writer.supportsOption(QImageIOHandler::Description)) - qDebug() << "Png supports embedded text"; -//! [0] - return 0; -} diff --git a/doc/src/snippets/matrix/matrix.cpp b/doc/src/snippets/matrix/matrix.cpp deleted file mode 100644 index 2aa2606fc6..0000000000 --- a/doc/src/snippets/matrix/matrix.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -class SimpleTransformation : public QWidget -{ - void paintEvent(QPaintEvent *); -}; - -//! [0] -void SimpleTransformation::paintEvent(QPaintEvent *) -{ - QPainter painter(this); - painter.setPen(QPen(Qt::blue, 1, Qt::DashLine)); - painter.drawRect(0, 0, 100, 100); - - painter.rotate(45); - - painter.setFont(QFont("Helvetica", 24)); - painter.setPen(QPen(Qt::black, 1)); - painter.drawText(20, 10, "QMatrix"); -} -//! [0] - -class CombinedTransformation : public QWidget -{ - void paintEvent(QPaintEvent *); -}; - -//! [1] -void CombinedTransformation::paintEvent(QPaintEvent *) -{ - QPainter painter(this); - painter.setPen(QPen(Qt::blue, 1, Qt::DashLine)); - painter.drawRect(0, 0, 100, 100); - - QMatrix matrix; - matrix.translate(50, 50); - matrix.rotate(45); - matrix.scale(0.5, 1.0); - painter.setMatrix(matrix); - - painter.setFont(QFont("Helvetica", 24)); - painter.setPen(QPen(Qt::black, 1)); - painter.drawText(20, 10, "QMatrix"); -} -//! [1] - -class BasicOperations : public QWidget -{ - void paintEvent(QPaintEvent *); -}; - -//! [2] -void BasicOperations::paintEvent(QPaintEvent *) -{ - double pi = 3.14; - - double a = pi/180 * 45.0; - double sina = sin(a); - double cosa = cos(a); - - QMatrix translationMatrix(1, 0, 0, 1, 50.0, 50.0); - QMatrix rotationMatrix(cosa, sina, -sina, cosa, 0, 0); - QMatrix scalingMatrix(0.5, 0, 0, 1.0, 0, 0); - - QMatrix matrix; - matrix = scalingMatrix * rotationMatrix * translationMatrix; - - QPainter painter(this); - painter.setPen(QPen(Qt::blue, 1, Qt::DashLine)); - painter.drawRect(0, 0, 100, 100); - - painter.setMatrix(matrix); - - painter.setFont(QFont("Helvetica", 24)); - painter.setPen(QPen(Qt::black, 1)); - painter.drawText(20, 10, "QMatrix"); -} -//! [2] - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - - QWidget widget; - - SimpleTransformation *simpleWidget = new SimpleTransformation; - CombinedTransformation *combinedWidget = new CombinedTransformation; - BasicOperations *basicWidget = new BasicOperations; - - QVBoxLayout *layout = new QVBoxLayout; - layout->addWidget(simpleWidget); - layout->addWidget(combinedWidget); - layout->addWidget(basicWidget); - widget.setLayout(layout); - - widget.show(); - widget.resize(130, 350); - return app.exec(); -} diff --git a/doc/src/snippets/picture/picture.cpp b/doc/src/snippets/picture/picture.cpp deleted file mode 100644 index 8de5e32323..0000000000 --- a/doc/src/snippets/picture/picture.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -void myProcessing(const QString &) -{ -} - -int main() -{ - QWidget myWidget; - { - // RECORD -//! [0] - QPicture picture; - QPainter painter; - painter.begin(&picture); // paint in picture - painter.drawEllipse(10,20, 80,70); // draw an ellipse - painter.end(); // painting done - picture.save("drawing.pic"); // save picture -//! [0] - } - - { - // REPLAY -//! [1] - QPicture picture; - picture.load("drawing.pic"); // load picture - QPainter painter; - painter.begin(&myImage); // paint in myImage - painter.drawPicture(0, 0, picture); // draw the picture at (0,0) - painter.end(); // painting done -//! [1] - } - - QPicture myPicture; - { - // FORMATS -//! [2] - QStringList list = QPicture::inputFormatList(); - foreach (const QString &string, list) - myProcessing(string); -//! [2] - } - - { - // OUTPUT -//! [3] - QStringList list = QPicture::outputFormatList(); - foreach (const QString &string, list) - myProcessing(string); -//! [3] - } - - { - // PIC READ -//! [4] - QPictureIO iio; - QPixmap pixmap; - iio.setFileName("vegeburger.pic"); - if (iio.read()) { // OK - QPicture picture = iio.picture(); - QPainter painter(&pixmap); - painter.drawPicture(0, 0, picture); - } -//! [4] - } - - { - QPixmap pixmap; - // PIC WRITE -//! [5] - QPictureIO iio; - QPicture picture; - QPainter painter(&picture); - painter.drawPixmap(0, 0, pixmap); - iio.setPicture(picture); - iio.setFileName("vegeburger.pic"); - iio.setFormat("PIC"); - if (iio.write()) - return true; // returned true if written successfully -//! [5] - } - -} - -// SVG READ -//! [6] -void readSVG(QPictureIO *picture) -{ - // read the picture using the picture->ioDevice() -} -//! [6] - -// SVG WRITE -//! [7] -void writeSVG(QPictureIO *picture) -{ - // write the picture using the picture->ioDevice() -} -//! [7] - -// USE SVG -void foo() { - -//! [8] - // add the SVG picture handler - // ... -//! [8] - QPictureIO::defineIOHandler("SVG", 0, 0, readSVG, writeSVG); - // ... - -} diff --git a/doc/src/snippets/polygon/polygon.cpp b/doc/src/snippets/polygon/polygon.cpp deleted file mode 100644 index 432156f8e6..0000000000 --- a/doc/src/snippets/polygon/polygon.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -int main() -{ - { - // STREAM -//! [0] - QPolygon polygon; - polygon << QPoint(10, 20) << QPoint(20, 30); -//! [0] - } - - { - // STREAMF -//! [1] - QPolygonF polygon; - polygon << QPointF(10.4, 20.5) << QPointF(20.2, 30.2); -//! [1] - } - - { - // SETPOINTS -//! [2] - static const int points[] = { 10, 20, 30, 40 }; - QPolygon polygon; - polygon.setPoints(2, points); -//! [2] - } - - { - // SETPOINTS2 -//! [3] - QPolygon polygon; - polygon.setPoints(2, 10, 20, 30, 40); -//! [3] - } - - { - // PUTPOINTS -//! [4] - QPolygon polygon(1); - polygon[0] = QPoint(4, 5); - polygon.putPoints(1, 2, 6,7, 8,9); -//! [4] - } - - { - // PUTPOINTS2 -//! [5] - QPolygon polygon(3); - polygon.putPoints(0, 3, 4,5, 0,0, 8,9); - polygon.putPoints(1, 1, 6,7); -//! [5] - } - - { - // PUTPOINTS3 -//! [6] - QPolygon polygon1; - polygon1.putPoints(0, 3, 1,2, 0,0, 5,6); - // polygon1 is now the three-point polygon(1,2, 0,0, 5,6); - - QPolygon polygon2; - polygon2.putPoints(0, 3, 4,4, 5,5, 6,6); - // polygon2 is now (4,4, 5,5, 6,6); - - polygon1.putPoints(2, 3, polygon2); - // polygon1 is now the five-point polygon(1,2, 0,0, 4,4, 5,5, 6,6); -//! [6] - } - return 0; -} diff --git a/doc/src/snippets/qfontdatabase/main.cpp b/doc/src/snippets/qfontdatabase/main.cpp deleted file mode 100644 index 8e98e309a0..0000000000 --- a/doc/src/snippets/qfontdatabase/main.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - -//! [0] - QFontDatabase database; - QTreeWidget fontTree; - fontTree.setColumnCount(2); - fontTree.setHeaderLabels(QStringList() << "Font" << "Smooth Sizes"); - - foreach (const QString &family, database.families()) { - QTreeWidgetItem *familyItem = new QTreeWidgetItem(&fontTree); - familyItem->setText(0, family); - - foreach (const QString &style, database.styles(family)) { - QTreeWidgetItem *styleItem = new QTreeWidgetItem(familyItem); - styleItem->setText(0, style); - - QString sizes; - foreach (int points, database.smoothSizes(family, style)) - sizes += QString::number(points) + " "; - - styleItem->setText(1, sizes.trimmed()); - } -//! [0] //! [1] - } -//! [1] - - fontTree.resizeColumnToContents(0); - fontTree.show(); - return app.exec(); -} diff --git a/doc/src/snippets/qstatustipevent/main.cpp b/doc/src/snippets/qstatustipevent/main.cpp deleted file mode 100644 index 9a1948f4e8..0000000000 --- a/doc/src/snippets/qstatustipevent/main.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -class MainWindow : public QMainWindow -{ -public: - MainWindow(QWidget *parent = 0); -}; - -//! [0] //! [1] -MainWindow::MainWindow(QWidget *parent) - : QMainWindow(parent) -{ -//! [0] - QWidget *myWidget = new QWidget; - myWidget->setStatusTip(tr("This is my widget.")); - - setCentralWidget(myWidget); -//! [1] - -//! [2] - QMenu *fileMenu = menuBar()->addMenu(tr("File")); - - QAction *newAct = new QAction(tr("&New"), this); - newAct->setStatusTip(tr("Create a new file.")); - fileMenu->addAction(newAct); -//! [2] - - statusBar()->showMessage(tr("Ready")); - setWindowTitle(tr("QStatusTipEvent")); -//! [3] -} -//! [3] - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - MainWindow window; - window.show(); - return app.exec(); -} - diff --git a/doc/src/snippets/separations/finalwidget.cpp b/doc/src/snippets/separations/finalwidget.cpp deleted file mode 100644 index 81a4aa1c42..0000000000 --- a/doc/src/snippets/separations/finalwidget.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* -finalwidget.cpp - -A widget to display an image and a label containing a description. -*/ - -#include -#include "finalwidget.h" - -FinalWidget::FinalWidget(QWidget *parent, const QString &name, - const QSize &labelSize) - : QFrame(parent) -{ - hasImage = false; - imageLabel = new QLabel; - imageLabel->setFrameShadow(QFrame::Sunken); - imageLabel->setFrameShape(QFrame::StyledPanel); - imageLabel->setMinimumSize(labelSize); - nameLabel = new QLabel(name); - - QVBoxLayout *layout = new QVBoxLayout; - layout->addWidget(imageLabel, 1); - layout->addWidget(nameLabel, 0); - setLayout(layout); -} - -/*! - If the mouse moves far enough when the left mouse button is held down, - start a drag and drop operation. -*/ - -void FinalWidget::mouseMoveEvent(QMouseEvent *event) -{ - if (!(event->buttons() & Qt::LeftButton)) - return; - if ((event->pos() - dragStartPosition).manhattanLength() - < QApplication::startDragDistance()) - return; - if (!hasImage) - return; - - QDrag *drag = new QDrag(this); - QMimeData *mimeData = new QMimeData; - -//! [0] - QByteArray output; - QBuffer outputBuffer(&output); - outputBuffer.open(QIODevice::WriteOnly); - imageLabel->pixmap()->toImage().save(&outputBuffer, "PNG"); - mimeData->setData("image/png", output); -//! [0] -/* -//! [1] - mimeData->setImageData(QVariant(*imageLabel->pixmap())); -//! [1] -*/ - drag->setMimeData(mimeData); - drag->setPixmap(imageLabel->pixmap()->scaled(64, 64, Qt::KeepAspectRatio)); -//! [2] - drag->setHotSpot(QPoint(drag->pixmap().width()/2, - drag->pixmap().height())); -//! [2] - - drag->start(); -} - -/*! - Check for left mouse button presses in order to enable drag and drop. -*/ - -void FinalWidget::mousePressEvent(QMouseEvent *event) -{ - if (event->button() == Qt::LeftButton) - dragStartPosition = event->pos(); -} - -const QPixmap* FinalWidget::pixmap() const -{ - return imageLabel->pixmap(); -} - -void FinalWidget::setPixmap(const QPixmap &pixmap) -{ - imageLabel->setPixmap(pixmap); - hasImage = true; -} diff --git a/doc/src/snippets/textblock-fragments/xmlwriter.cpp b/doc/src/snippets/textblock-fragments/xmlwriter.cpp deleted file mode 100644 index cd9beadd00..0000000000 --- a/doc/src/snippets/textblock-fragments/xmlwriter.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "xmlwriter.h" - -QDomDocument *XmlWriter::toXml() -{ - QDomImplementation implementation; - QDomDocumentType docType = implementation.createDocumentType( - "scribe-document", "scribe", "qt.nokia.com/scribe"); - - document = new QDomDocument(docType); - - // ### This processing instruction is required to ensure that any kind - // of encoding is given when the document is written. - QDomProcessingInstruction process = document->createProcessingInstruction( - "xml", "version=\"1.0\" encoding=\"utf-8\""); - document->appendChild(process); - - QDomElement documentElement = document->createElement("document"); - document->appendChild(documentElement); - -//! [0] - QTextBlock currentBlock = textDocument->begin(); - - while (currentBlock.isValid()) { -//! [0] - QDomElement blockElement = document->createElement("block"); - document->appendChild(blockElement); - - readFragment(currentBlock, blockElement, document); - -//! [1] - processBlock(currentBlock); -//! [1] - -//! [2] - currentBlock = currentBlock.next(); - } -//! [2] - - return document; -} - -void XmlWriter::readFragment(const QTextBlock ¤tBlock, - QDomElement blockElement, - QDomDocument *document) -{ -//! [3] //! [4] - QTextBlock::iterator it; - for (it = currentBlock.begin(); !(it.atEnd()); ++it) { - QTextFragment currentFragment = it.fragment(); - if (currentFragment.isValid()) -//! [3] //! [5] - processFragment(currentFragment); -//! [4] //! [5] - - if (currentFragment.isValid()) { - QDomElement fragmentElement = document->createElement("fragment"); - blockElement.appendChild(fragmentElement); - - fragmentElement.setAttribute("length", currentFragment.length()); - QDomText fragmentText = document->createTextNode(currentFragment.text()); - - fragmentElement.appendChild(fragmentText); - } -//! [6] //! [7] - } -//! [7] //! [6] -} - -void XmlWriter::processBlock(const QTextBlock ¤tBlock) -{ -} - -void XmlWriter::processFragment(const QTextFragment ¤tFragment) -{ -} diff --git a/doc/src/snippets/textdocument-css/main.cpp b/doc/src/snippets/textdocument-css/main.cpp deleted file mode 100644 index 55b8571224..0000000000 --- a/doc/src/snippets/textdocument-css/main.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - -//! [0] - QTextBrowser browser; - QColor linkColor(Qt::red); - QString sheet = QString::fromLatin1("a { text-decoration: underline; color: %1 }").arg(linkColor.name()); - browser.document()->setDefaultStyleSheet(sheet); -//! [0] - browser.setSource(QUrl("../../../html/index.html")); - browser.resize(800, 600); - browser.show(); - - return app.exec(); -} - diff --git a/doc/src/snippets/textdocument-listitemstyles/main.cpp b/doc/src/snippets/textdocument-listitemstyles/main.cpp deleted file mode 100644 index 223ec22bae..0000000000 --- a/doc/src/snippets/textdocument-listitemstyles/main.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "mainwindow.h" - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - MainWindow *window = new MainWindow; - window->resize(640, 480); - window->show(); - return app.exec(); -} diff --git a/doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp b/doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp deleted file mode 100644 index 029695eca3..0000000000 --- a/doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "mainwindow.h" - -MainWindow::MainWindow() -{ - QMenu *fileMenu = new QMenu(tr("&File")); - - fileMenu->addAction(tr("E&xit"), this, SLOT(close()), - QKeySequence(tr("Ctrl+Q", "File|Exit"))); - - QMenu *insertMenu = new QMenu(tr("&Insert")); - - insertMenu->addAction(tr("&List"), this, SLOT(insertList()), - QKeySequence(tr("Ctrl+L", "Insert|List"))); - - menuBar()->addMenu(fileMenu); - menuBar()->addMenu(insertMenu); - - editor = new QTextEdit(this); - document = new QTextDocument(this); - editor->setDocument(document); - - setCentralWidget(editor); - setWindowTitle(tr("Text Document List Item Styles")); -} - -void MainWindow::insertList() -{ - QTextCursor cursor = editor->textCursor(); - cursor.beginEditBlock(); - - //! [add a styled, ordered list] - QTextListFormat listFormat; - - listFormat.setStyle(QTextListFormat::ListDecimal); - listFormat.setNumberPrefix("("); - listFormat.setNumberSuffix(")"); - - cursor.insertList(listFormat); - //! [add a styled, ordered list] - - cursor.endEditBlock(); -} diff --git a/doc/src/snippets/textdocument-listitemstyles/mainwindow.h b/doc/src/snippets/textdocument-listitemstyles/mainwindow.h deleted file mode 100644 index fc5c6db2a7..0000000000 --- a/doc/src/snippets/textdocument-listitemstyles/mainwindow.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef WINDOW_H -#define WINDOW_H - -#include - -class QTextDocument; -class QTextEdit; - -class MainWindow : public QMainWindow -{ - Q_OBJECT - -public: - MainWindow(); - -public slots: - void insertList(); - -private: - QString currentFile; - QTextEdit *editor; - QTextDocument *document; -}; - -#endif diff --git a/doc/src/snippets/textdocument-listitemstyles/textdocument-listitemstyles.pro b/doc/src/snippets/textdocument-listitemstyles/textdocument-listitemstyles.pro deleted file mode 100644 index 5da8d6e1a1..0000000000 --- a/doc/src/snippets/textdocument-listitemstyles/textdocument-listitemstyles.pro +++ /dev/null @@ -1,3 +0,0 @@ -HEADERS = mainwindow.h -SOURCES = main.cpp \ - mainwindow.cpp diff --git a/doc/src/snippets/textdocument-lists/mainwindow.cpp b/doc/src/snippets/textdocument-lists/mainwindow.cpp deleted file mode 100644 index 7ae36b0ced..0000000000 --- a/doc/src/snippets/textdocument-lists/mainwindow.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "mainwindow.h" - -MainWindow::MainWindow() -{ - QMenu *fileMenu = new QMenu(tr("&File")); - - fileMenu->addAction(tr("E&xit"), this, SLOT(close()), - QKeySequence(tr("Ctrl+Q", "File|Exit"))); - - QMenu *editMenu = new QMenu(tr("&Edit")); - - cutAction = editMenu->addAction(tr("Cu&t"), this, SLOT(cutSelection()), - QKeySequence(tr("Ctrl+X", "Edit|Cut"))); - copyAction = editMenu->addAction(tr("&Copy"), this, SLOT(copySelection()), - QKeySequence(tr("Ctrl+C", "Edit|Copy"))); - pasteAction = editMenu->addAction(tr("&Paste"), this, - SLOT(pasteSelection()), QKeySequence(tr("Ctrl+V", "Edit|Paste"))); - - QMenu *selectMenu = new QMenu(tr("&Select")); - selectMenu->addAction(tr("&Word"), this, SLOT(selectWord())); - selectMenu->addAction(tr("&Line"), this, SLOT(selectLine())); - selectMenu->addAction(tr("&Block"), this, SLOT(selectBlock())); - selectMenu->addAction(tr("&Frame"), this, SLOT(selectFrame())); - - QMenu *insertMenu = new QMenu(tr("&Insert")); - - insertMenu->addAction(tr("&List"), this, SLOT(insertList()), - QKeySequence(tr("Ctrl+L", "Insert|List"))); - - menuBar()->addMenu(fileMenu); - menuBar()->addMenu(editMenu); - menuBar()->addMenu(selectMenu); - menuBar()->addMenu(insertMenu); - - editor = new QTextEdit(this); - document = new QTextDocument(this); - editor->setDocument(document); - - connect(editor, SIGNAL(selectionChanged()), this, SLOT(updateMenus())); - - updateMenus(); - - setCentralWidget(editor); - setWindowTitle(tr("Text Document Writer")); -} - -void MainWindow::cutSelection() -{ - QTextCursor cursor = editor->textCursor(); - if (cursor.hasSelection()) { - selection = cursor.selection(); - cursor.removeSelectedText(); - } -} - -void MainWindow::copySelection() -{ - QTextCursor cursor = editor->textCursor(); - if (cursor.hasSelection()) { - selection = cursor.selection(); - cursor.clearSelection(); - } -} - -void MainWindow::pasteSelection() -{ - QTextCursor cursor = editor->textCursor(); - cursor.insertFragment(selection); -} - -void MainWindow::selectWord() -{ - QTextCursor cursor = editor->textCursor(); - QTextBlock block = cursor.block(); - - cursor.beginEditBlock(); - cursor.movePosition(QTextCursor::StartOfWord); - cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor); - cursor.endEditBlock(); - - editor->setTextCursor(cursor); -} - -void MainWindow::selectLine() -{ - QTextCursor cursor = editor->textCursor(); - QTextBlock block = cursor.block(); - - cursor.beginEditBlock(); - cursor.movePosition(QTextCursor::StartOfLine); - cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor); - cursor.endEditBlock(); - - editor->setTextCursor(cursor); -} - -void MainWindow::selectBlock() -{ - QTextCursor cursor = editor->textCursor(); - QTextBlock block = cursor.block(); - - cursor.beginEditBlock(); - cursor.movePosition(QTextCursor::StartOfBlock); - cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); - cursor.endEditBlock(); - - editor->setTextCursor(cursor); -} - -void MainWindow::selectFrame() -{ - QTextCursor cursor = editor->textCursor(); - QTextFrame *frame = cursor.currentFrame(); - - cursor.beginEditBlock(); - cursor.setPosition(frame->firstPosition()); - cursor.setPosition(frame->lastPosition(), QTextCursor::KeepAnchor); - cursor.endEditBlock(); - - editor->setTextCursor(cursor); -} - -void MainWindow::insertList() -{ - QTextCursor cursor = editor->textCursor(); - cursor.beginEditBlock(); - - QTextList *list = cursor.currentList(); -//! [0] - QTextListFormat listFormat; - if (list) { - listFormat = list->format(); - listFormat.setIndent(listFormat.indent() + 1); - } - - listFormat.setStyle(QTextListFormat::ListDisc); - cursor.insertList(listFormat); -//! [0] - - cursor.endEditBlock(); -} - -void MainWindow::updateMenus() -{ - QTextCursor cursor = editor->textCursor(); - cutAction->setEnabled(cursor.hasSelection()); - copyAction->setEnabled(cursor.hasSelection()); - - pasteAction->setEnabled(!selection.isEmpty()); -} diff --git a/doc/src/snippets/textdocument-resources/main.cpp b/doc/src/snippets/textdocument-resources/main.cpp deleted file mode 100644 index ed26793d78..0000000000 --- a/doc/src/snippets/textdocument-resources/main.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -QString tr(const char *text) -{ - return QApplication::translate(text, text); -} - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - QTextEdit *editor = new QTextEdit; - - QTextDocument *document = new QTextDocument(editor); - QTextCursor cursor(document); - - QImage image(64, 64, QImage::Format_RGB32); - image.fill(qRgb(255, 160, 128)); - -//! [Adding a resource] - document->addResource(QTextDocument::ImageResource, - QUrl("mydata://image.png"), QVariant(image)); -//! [Adding a resource] - -//! [Inserting an image with a cursor] - QTextImageFormat imageFormat; - imageFormat.setName("mydata://image.png"); - cursor.insertImage(imageFormat); -//! [Inserting an image with a cursor] - - cursor.insertBlock(); - cursor.insertText("Code less. Create more."); - - editor->setDocument(document); - editor->setWindowTitle(tr("Text Document Images")); - editor->resize(320, 480); - editor->show(); - -//! [Inserting an image using HTML] - editor->append(""); -//! [Inserting an image using HTML] - - return app.exec(); -} diff --git a/doc/src/snippets/textdocument-resources/textdocument-resources.pro b/doc/src/snippets/textdocument-resources/textdocument-resources.pro deleted file mode 100644 index 16181f21cf..0000000000 --- a/doc/src/snippets/textdocument-resources/textdocument-resources.pro +++ /dev/null @@ -1 +0,0 @@ -SOURCES = main.cpp diff --git a/doc/src/snippets/textdocument-tables/mainwindow.cpp b/doc/src/snippets/textdocument-tables/mainwindow.cpp deleted file mode 100644 index 79e5f03df4..0000000000 --- a/doc/src/snippets/textdocument-tables/mainwindow.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "mainwindow.h" -#include "xmlwriter.h" - -MainWindow::MainWindow() -{ - QMenu *fileMenu = new QMenu(tr("&File")); - - QAction *saveAction = fileMenu->addAction(tr("&Save...")); - saveAction->setShortcut(tr("Ctrl+S")); - QAction *quitAction = fileMenu->addAction(tr("E&xit")); - quitAction->setShortcut(tr("Ctrl+Q")); - - QMenu *showMenu = new QMenu(tr("&Show")); - - QAction *showTableAction = showMenu->addAction(tr("&Table")); - - menuBar()->addMenu(fileMenu); - menuBar()->addMenu(showMenu); - - editor = new QTextEdit(); - -//! [0] //! [1] - QTextCursor cursor(editor->textCursor()); -//! [0] - cursor.movePosition(QTextCursor::Start); -//! [1] - - int rows = 11; - int columns = 4; - -//! [2] - QTextTableFormat tableFormat; - tableFormat.setBackground(QColor("#e0e0e0")); - QVector constraints; - constraints << QTextLength(QTextLength::PercentageLength, 16); - constraints << QTextLength(QTextLength::PercentageLength, 28); - constraints << QTextLength(QTextLength::PercentageLength, 28); - constraints << QTextLength(QTextLength::PercentageLength, 28); - tableFormat.setColumnWidthConstraints(constraints); -//! [3] - QTextTable *table = cursor.insertTable(rows, columns, tableFormat); -//! [2] //! [3] - - int column; - int row; - QTextTableCell cell; - QTextCursor cellCursor; - - QTextCharFormat charFormat; - charFormat.setForeground(Qt::black); - -//! [4] - cell = table->cellAt(0, 0); - cellCursor = cell.firstCursorPosition(); - cellCursor.insertText(tr("Week"), charFormat); -//! [4] - -//! [5] - for (column = 1; column < columns; ++column) { - cell = table->cellAt(0, column); - cellCursor = cell.firstCursorPosition(); - cellCursor.insertText(tr("Team %1").arg(column), charFormat); - } - - for (row = 1; row < rows; ++row) { - cell = table->cellAt(row, 0); - cellCursor = cell.firstCursorPosition(); - cellCursor.insertText(tr("%1").arg(row), charFormat); - - for (column = 1; column < columns; ++column) { - if ((row-1) % 3 == column-1) { -//! [5] //! [6] - cell = table->cellAt(row, column); - QTextCursor cellCursor = cell.firstCursorPosition(); - cellCursor.insertText(tr("On duty"), charFormat); - } -//! [6] //! [7] - } -//! [7] //! [8] - } -//! [8] - - connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile())); - connect(quitAction, SIGNAL(triggered()), this, SLOT(close())); - connect(showTableAction, SIGNAL(triggered()), this, SLOT(showTable())); - - setCentralWidget(editor); - setWindowTitle(tr("Text Document Tables")); -} - -void MainWindow::saveFile() -{ - QString fileName = QFileDialog::getSaveFileName(this, - tr("Save document as:"), "", tr("XML (*.xml)")); - - if (!fileName.isEmpty()) { - if (writeXml(fileName)) - setWindowTitle(fileName); - else - QMessageBox::warning(this, tr("Warning"), - tr("Failed to save the document."), QMessageBox::Cancel, - QMessageBox::NoButton); - } -} - -void MainWindow::showTable() -{ - QTextCursor cursor = editor->textCursor(); - QTextTable *table = cursor.currentTable(); - - if (!table) - return; - - QTableWidget *tableWidget = new QTableWidget(table->rows(), table->columns()); - -//! [9] - for (int row = 0; row < table->rows(); ++row) { - for (int column = 0; column < table->columns(); ++column) { - QTextTableCell tableCell = table->cellAt(row, column); -//! [9] - QTextFrame::iterator it; - QString text; - for (it = tableCell.begin(); !(it.atEnd()); ++it) { - QTextBlock childBlock = it.currentBlock(); - if (childBlock.isValid()) - text += childBlock.text(); - } - QTableWidgetItem *newItem = new QTableWidgetItem(text); - tableWidget->setItem(row, column, newItem); - /* -//! [10] - processTableCell(tableCell); -//! [10] - */ -//! [11] - } -//! [11] //! [12] - } -//! [12] - - tableWidget->setWindowTitle(tr("Table Contents")); - tableWidget->show(); -} - -bool MainWindow::writeXml(const QString &fileName) -{ - XmlWriter documentWriter(editor->document()); - - QDomDocument *domDocument = documentWriter.toXml(); - QFile file(fileName); - - if (file.open(QFile::WriteOnly)) { - QTextStream textStream(&file); - textStream.setCodec(QTextCodec::codecForName("UTF-8")); - - textStream << domDocument->toString(1).toUtf8(); - file.close(); - return true; - } - else - return false; -} diff --git a/doc/src/snippets/textdocument-texttable/main.cpp b/doc/src/snippets/textdocument-texttable/main.cpp deleted file mode 100644 index ca5338533c..0000000000 --- a/doc/src/snippets/textdocument-texttable/main.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -int main(int argc, char * argv[]) -{ - int rows = 6; - int columns = 2; - - QApplication app(argc, argv); - QTextEdit *textEdit = new QTextEdit; - QTextCursor cursor(textEdit->textCursor()); - cursor.movePosition(QTextCursor::Start); - - QTextTableFormat tableFormat; - tableFormat.setAlignment(Qt::AlignHCenter); - tableFormat.setCellPadding(2); - tableFormat.setCellSpacing(2); - QTextTable *table = cursor.insertTable(rows, columns); - table->setFormat(tableFormat); - - QTextCharFormat boldFormat; - boldFormat.setFontWeight(QFont::Bold); - - QTextBlockFormat centerFormat; - centerFormat.setAlignment(Qt::AlignHCenter); - cursor.mergeBlockFormat(centerFormat); - - cursor = table->cellAt(0, 0).firstCursorPosition(); - cursor.insertText(("Details"), boldFormat); - - cursor = table->cellAt(1, 0).firstCursorPosition(); - cursor.insertText("Alan"); - - cursor = table->cellAt(1, 1).firstCursorPosition(); - cursor.insertText("5, Pickety Street"); - -//! [0] - table->mergeCells(0, 0, 1, 2); -//! [0] //! [1] - table->splitCell(0, 0, 1, 1); -//! [1] - - textEdit->show(); - return app.exec(); -} diff --git a/doc/src/snippets/textdocumentendsnippet.cpp b/doc/src/snippets/textdocumentendsnippet.cpp deleted file mode 100644 index caec20dc9b..0000000000 --- a/doc/src/snippets/textdocumentendsnippet.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -int main(int argv, char **args) -{ - QString contentString("One\nTwp\nThree"); - - QTextDocument *doc = new QTextDocument(contentString); - -//! [0] - for (QTextBlock it = doc->begin(); it != doc->end(); it = it.next()) - cout << it.text().toStdString() << endl; -//! [0] - - return 0; -} diff --git a/doc/src/snippets/transform/main.cpp b/doc/src/snippets/transform/main.cpp deleted file mode 100644 index d1c600828d..0000000000 --- a/doc/src/snippets/transform/main.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -class SimpleTransformation : public QWidget -{ - void paintEvent(QPaintEvent *); -}; - -//! [0] -void SimpleTransformation::paintEvent(QPaintEvent *) -{ - QPainter painter(this); - painter.setPen(QPen(Qt::blue, 1, Qt::DashLine)); - painter.drawRect(0, 0, 100, 100); - - painter.rotate(45); - - painter.setFont(QFont("Helvetica", 24)); - painter.setPen(QPen(Qt::black, 1)); - painter.drawText(20, 10, "QTransform"); -} -//! [0] - -class CombinedTransformation : public QWidget -{ - void paintEvent(QPaintEvent *); -}; - -//! [1] -void CombinedTransformation::paintEvent(QPaintEvent *) -{ - QPainter painter(this); - painter.setPen(QPen(Qt::blue, 1, Qt::DashLine)); - painter.drawRect(0, 0, 100, 100); - - QTransform transform; - transform.translate(50, 50); - transform.rotate(45); - transform.scale(0.5, 1.0); - painter.setTransform(transform); - - painter.setFont(QFont("Helvetica", 24)); - painter.setPen(QPen(Qt::black, 1)); - painter.drawText(20, 10, "QTransform"); -} -//! [1] - -class BasicOperations : public QWidget -{ - void paintEvent(QPaintEvent *); -}; - -//! [2] -void BasicOperations::paintEvent(QPaintEvent *) -{ - double pi = 3.14; - - double a = pi/180 * 45.0; - double sina = sin(a); - double cosa = cos(a); - - QTransform translationTransform(1, 0, 0, 1, 50.0, 50.0); - QTransform rotationTransform(cosa, sina, -sina, cosa, 0, 0); - QTransform scalingTransform(0.5, 0, 0, 1.0, 0, 0); - - QTransform transform; - transform = scalingTransform * rotationTransform * translationTransform; - - QPainter painter(this); - painter.setPen(QPen(Qt::blue, 1, Qt::DashLine)); - painter.drawRect(0, 0, 100, 100); - - painter.setTransform(transform); - - painter.setFont(QFont("Helvetica", 24)); - painter.setPen(QPen(Qt::black, 1)); - painter.drawText(20, 10, "QTransform"); -} -//! [2] - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - - QWidget widget; - - SimpleTransformation *simpleWidget = new SimpleTransformation; - CombinedTransformation *combinedWidget = new CombinedTransformation; - BasicOperations *basicWidget = new BasicOperations; - - QVBoxLayout *layout = new QVBoxLayout; - layout->addWidget(simpleWidget); - layout->addWidget(combinedWidget); - layout->addWidget(basicWidget); - widget.setLayout(layout); - - widget.show(); - widget.resize(130, 350); - return app.exec(); -} -- cgit v1.2.3