summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible.cpp2
-rw-r--r--src/gui/doc/images/brush-outline.pngbin0 -> 452 bytes
-rw-r--r--src/gui/doc/images/brush-styles.pngbin0 -> 13980 bytes
-rw-r--r--src/gui/doc/images/coordinatesystem-analogclock.pngbin0 -> 9762 bytes
-rw-r--r--src/gui/doc/images/coordinatesystem-line-antialias.pngbin0 -> 17979 bytes
-rw-r--r--src/gui/doc/images/coordinatesystem-line-raster.pngbin0 -> 18152 bytes
-rw-r--r--src/gui/doc/images/coordinatesystem-line.pngbin0 -> 26694 bytes
-rw-r--r--src/gui/doc/images/coordinatesystem-rect-antialias.pngbin0 -> 19058 bytes
-rw-r--r--src/gui/doc/images/coordinatesystem-rect-raster.pngbin0 -> 18455 bytes
-rw-r--r--src/gui/doc/images/coordinatesystem-rect.pngbin0 -> 32307 bytes
-rw-r--r--src/gui/doc/images/coordinatesystem-transformations.pngbin0 -> 59180 bytes
-rw-r--r--src/gui/doc/images/cursor-arrow.pngbin0 -> 171 bytes
-rw-r--r--src/gui/doc/images/cursor-busy.pngbin0 -> 201 bytes
-rw-r--r--src/gui/doc/images/cursor-closedhand.pngbin0 -> 147 bytes
-rw-r--r--src/gui/doc/images/cursor-cross.pngbin0 -> 130 bytes
-rw-r--r--src/gui/doc/images/cursor-forbidden.pngbin0 -> 199 bytes
-rw-r--r--src/gui/doc/images/cursor-hand.pngbin0 -> 159 bytes
-rw-r--r--src/gui/doc/images/cursor-hsplit.pngbin0 -> 155 bytes
-rw-r--r--src/gui/doc/images/cursor-ibeam.pngbin0 -> 124 bytes
-rw-r--r--src/gui/doc/images/cursor-openhand.pngbin0 -> 160 bytes
-rw-r--r--src/gui/doc/images/cursor-sizeall.pngbin0 -> 174 bytes
-rw-r--r--src/gui/doc/images/cursor-sizeb.pngbin0 -> 161 bytes
-rw-r--r--src/gui/doc/images/cursor-sizef.pngbin0 -> 161 bytes
-rw-r--r--src/gui/doc/images/cursor-sizeh.pngbin0 -> 145 bytes
-rw-r--r--src/gui/doc/images/cursor-sizev.pngbin0 -> 141 bytes
-rw-r--r--src/gui/doc/images/cursor-uparrow.pngbin0 -> 132 bytes
-rw-r--r--src/gui/doc/images/cursor-vsplit.pngbin0 -> 161 bytes
-rw-r--r--src/gui/doc/images/cursor-wait.pngbin0 -> 172 bytes
-rw-r--r--src/gui/doc/images/cursor-whatsthis.pngbin0 -> 191 bytes
-rw-r--r--src/gui/doc/images/hoverevents.pngbin0 -> 3210 bytes
-rw-r--r--src/gui/doc/images/paintsystem-antialiasing.pngbin0 -> 995 bytes
-rw-r--r--src/gui/doc/images/paintsystem-core.pngbin0 -> 22101 bytes
-rw-r--r--src/gui/doc/images/paintsystem-devices.pngbin0 -> 47404 bytes
-rw-r--r--src/gui/doc/images/paintsystem-fancygradient.pngbin0 -> 39213 bytes
-rw-r--r--src/gui/doc/images/paintsystem-gradients.pngbin0 -> 16931 bytes
-rw-r--r--src/gui/doc/images/paintsystem-icon.pngbin0 -> 5458 bytes
-rw-r--r--src/gui/doc/images/paintsystem-movie.pngbin0 -> 4992 bytes
-rw-r--r--src/gui/doc/images/paintsystem-painterpath.pngbin0 -> 7503 bytes
-rw-r--r--src/gui/doc/images/paintsystem-stylepainter.pngbin0 -> 16572 bytes
-rw-r--r--src/gui/doc/images/paintsystem-svg.pngbin0 -> 66692 bytes
-rw-r--r--src/gui/doc/images/qcolor-cmyk.pngbin0 -> 18878 bytes
-rw-r--r--src/gui/doc/images/qcolor-hsv.pngbin0 -> 21046 bytes
-rw-r--r--src/gui/doc/images/qcolor-hue.pngbin0 -> 26820 bytes
-rw-r--r--src/gui/doc/images/qcolor-rgb.pngbin0 -> 17798 bytes
-rw-r--r--src/gui/doc/images/qcolor-saturation.pngbin0 -> 2150 bytes
-rw-r--r--src/gui/doc/images/qcolor-value.pngbin0 -> 1241 bytes
-rw-r--r--src/gui/doc/images/qconicalgradient.pngbin0 -> 52823 bytes
-rw-r--r--src/gui/doc/images/qgradient-conical.pngbin0 -> 3995 bytes
-rw-r--r--src/gui/doc/images/qgradient-linear.pngbin0 -> 714 bytes
-rw-r--r--src/gui/doc/images/qgradient-radial.pngbin0 -> 2352 bytes
-rw-r--r--src/gui/doc/images/qimage-32bit_scaled.pngbin0 -> 25098 bytes
-rw-r--r--src/gui/doc/images/qimage-8bit_scaled.pngbin0 -> 24761 bytes
-rw-r--r--src/gui/doc/images/qimage-scaling.pngbin0 -> 34785 bytes
-rw-r--r--src/gui/doc/images/qlineargradient-pad.pngbin0 -> 2260 bytes
-rw-r--r--src/gui/doc/images/qlineargradient-reflect.pngbin0 -> 2746 bytes
-rw-r--r--src/gui/doc/images/qlineargradient-repeat.pngbin0 -> 2590 bytes
-rw-r--r--src/gui/doc/images/qmatrix-combinedtransformation.pngbin0 -> 1707 bytes
-rw-r--r--src/gui/doc/images/qmatrix-representation.pngbin0 -> 10410 bytes
-rw-r--r--src/gui/doc/images/qmatrix-simpletransformation.pngbin0 -> 2047 bytes
-rw-r--r--src/gui/doc/images/qpainter-affinetransformations.pngbin0 -> 66241 bytes
-rw-r--r--src/gui/doc/images/qpainter-arc.pngbin0 -> 635 bytes
-rw-r--r--src/gui/doc/images/qpainter-basicdrawing.pngbin0 -> 18164 bytes
-rw-r--r--src/gui/doc/images/qpainter-chord.pngbin0 -> 632 bytes
-rw-r--r--src/gui/doc/images/qpainter-clock.pngbin0 -> 3128 bytes
-rw-r--r--src/gui/doc/images/qpainter-compositiondemo.pngbin0 -> 61015 bytes
-rw-r--r--src/gui/doc/images/qpainter-compositionmode1.pngbin0 -> 2418 bytes
-rw-r--r--src/gui/doc/images/qpainter-compositionmode2.pngbin0 -> 2131 bytes
-rw-r--r--src/gui/doc/images/qpainter-concentriccircles.pngbin0 -> 31294 bytes
-rw-r--r--src/gui/doc/images/qpainter-ellipse.pngbin0 -> 1022 bytes
-rw-r--r--src/gui/doc/images/qpainter-gradients.pngbin0 -> 24231 bytes
-rw-r--r--src/gui/doc/images/qpainter-line.pngbin0 -> 759 bytes
-rw-r--r--src/gui/doc/images/qpainter-painterpaths.pngbin0 -> 31985 bytes
-rw-r--r--src/gui/doc/images/qpainter-path.pngbin0 -> 963 bytes
-rw-r--r--src/gui/doc/images/qpainter-pathstroking.pngbin0 -> 30794 bytes
-rw-r--r--src/gui/doc/images/qpainter-pie.pngbin0 -> 1018 bytes
-rw-r--r--src/gui/doc/images/qpainter-polygon.pngbin0 -> 699 bytes
-rw-r--r--src/gui/doc/images/qpainter-rectangle.pngbin0 -> 194 bytes
-rw-r--r--src/gui/doc/images/qpainter-rotation.pngbin0 -> 3768 bytes
-rw-r--r--src/gui/doc/images/qpainter-roundrect.pngbin0 -> 433 bytes
-rw-r--r--src/gui/doc/images/qpainter-scale.pngbin0 -> 2828 bytes
-rw-r--r--src/gui/doc/images/qpainter-text.pngbin0 -> 1391 bytes
-rw-r--r--src/gui/doc/images/qpainter-translation.pngbin0 -> 3909 bytes
-rw-r--r--src/gui/doc/images/qpainter-vectordeformation.pngbin0 -> 30591 bytes
-rw-r--r--src/gui/doc/images/qpainterpath-addellipse.pngbin0 -> 3509 bytes
-rw-r--r--src/gui/doc/images/qpainterpath-addpolygon.pngbin0 -> 7625 bytes
-rw-r--r--src/gui/doc/images/qpainterpath-addrectangle.pngbin0 -> 1839 bytes
-rw-r--r--src/gui/doc/images/qpainterpath-addtext.pngbin0 -> 7406 bytes
-rw-r--r--src/gui/doc/images/qpainterpath-arcto.pngbin0 -> 5063 bytes
-rw-r--r--src/gui/doc/images/qpainterpath-construction.pngbin0 -> 2523 bytes
-rw-r--r--src/gui/doc/images/qpainterpath-cubicto.pngbin0 -> 4749 bytes
-rw-r--r--src/gui/doc/images/qpainterpath-demo.pngbin0 -> 51334 bytes
-rw-r--r--src/gui/doc/images/qpainterpath-example.pngbin0 -> 38746 bytes
-rw-r--r--src/gui/doc/images/qpen-bevel.pngbin0 -> 11527 bytes
-rw-r--r--src/gui/doc/images/qpen-custom.pngbin0 -> 6254 bytes
-rw-r--r--src/gui/doc/images/qpen-dash.pngbin0 -> 8221 bytes
-rw-r--r--src/gui/doc/images/qpen-dashdot.pngbin0 -> 5961 bytes
-rw-r--r--src/gui/doc/images/qpen-dashdotdot.pngbin0 -> 5999 bytes
-rw-r--r--src/gui/doc/images/qpen-dashpattern.pngbin0 -> 1605 bytes
-rw-r--r--src/gui/doc/images/qpen-demo.pngbin0 -> 49784 bytes
-rw-r--r--src/gui/doc/images/qpen-dot.pngbin0 -> 5386 bytes
-rw-r--r--src/gui/doc/images/qpen-flat.pngbin0 -> 1885 bytes
-rw-r--r--src/gui/doc/images/qpen-miter.pngbin0 -> 11734 bytes
-rw-r--r--src/gui/doc/images/qpen-miterlimit.pngbin0 -> 24816 bytes
-rw-r--r--src/gui/doc/images/qpen-roundcap.pngbin0 -> 1920 bytes
-rw-r--r--src/gui/doc/images/qpen-roundjoin.pngbin0 -> 11878 bytes
-rw-r--r--src/gui/doc/images/qpen-solid.pngbin0 -> 7416 bytes
-rw-r--r--src/gui/doc/images/qpen-square.pngbin0 -> 2651 bytes
-rw-r--r--src/gui/doc/images/qradialgradient-pad.pngbin0 -> 11385 bytes
-rw-r--r--src/gui/doc/images/qradialgradient-reflect.pngbin0 -> 33668 bytes
-rw-r--r--src/gui/doc/images/qradialgradient-repeat.pngbin0 -> 40528 bytes
-rw-r--r--src/gui/doc/images/qstatustipevent-action.pngbin0 -> 10741 bytes
-rw-r--r--src/gui/doc/images/qstatustipevent-widget.pngbin0 -> 9417 bytes
-rw-r--r--src/gui/doc/images/qt-fillrule-oddeven.pngbin0 -> 7057 bytes
-rw-r--r--src/gui/doc/images/qt-fillrule-winding.pngbin0 -> 7205 bytes
-rw-r--r--src/gui/doc/images/qtexttableformat-cell.pngbin0 -> 24454 bytes
-rw-r--r--src/gui/doc/images/qtransform-combinedtransformation.pngbin0 -> 935 bytes
-rw-r--r--src/gui/doc/images/qtransform-combinedtransformation2.pngbin0 -> 930 bytes
-rw-r--r--src/gui/doc/images/qtransform-representation.pngbin0 -> 17385 bytes
-rw-r--r--src/gui/doc/images/qtransform-simpletransformation.pngbin0 -> 1201 bytes
-rw-r--r--src/gui/doc/images/texttable-merge.pngbin0 -> 746 bytes
-rw-r--r--src/gui/doc/images/texttable-split.pngbin0 -> 753 bytes
-rw-r--r--src/gui/doc/qtgui.qdocconf92
-rw-r--r--src/gui/doc/snippets/brush/brush.cpp86
-rw-r--r--src/gui/doc/snippets/brush/gradientcreationsnippet.cpp62
-rw-r--r--src/gui/doc/snippets/code/doc_src_qtgui.pro3
-rw-r--r--src/gui/doc/snippets/code/src_gui_accessible_qaccessible.cpp43
-rw-r--r--src/gui/doc/snippets/code/src_gui_image_qimage.cpp82
-rw-r--r--src/gui/doc/snippets/code/src_gui_image_qimagereader.cpp66
-rw-r--r--src/gui/doc/snippets/code/src_gui_image_qimagewriter.cpp59
-rw-r--r--src/gui/doc/snippets/code/src_gui_image_qmovie.cpp53
-rw-r--r--src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp58
-rw-r--r--src/gui/doc/snippets/code/src_gui_image_qpixmapcache.cpp61
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp183
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qapplication_x11.cpp45
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qclipboard.cpp53
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qevent.cpp56
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qkeysequence.cpp59
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qshortcutmap.cpp43
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qbrush.cpp51
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qcolor.cpp49
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qmatrix.cpp62
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp259
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qpainterpath.cpp149
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qpen.cpp81
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qregion.cpp53
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qregion_unix.cpp54
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qtransform.cpp82
-rw-r--r--src/gui/doc/snippets/code/src_gui_qopenglshaderprogram.cpp94
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qfont.cpp67
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp54
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qsyntaxhighlighter.cpp126
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qtextcursor.cpp80
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qtextdocument.cpp43
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qtextdocumentwriter.cpp45
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qtextlayout.cpp62
-rw-r--r--src/gui/doc/snippets/code/src_gui_util_qdesktopservices.cpp60
-rw-r--r--src/gui/doc/snippets/code/src_gui_util_qvalidator.cpp135
-rw-r--r--src/gui/doc/snippets/dragging/mainwindow.cpp110
-rw-r--r--src/gui/doc/snippets/droparea.cpp140
-rw-r--r--src/gui/doc/snippets/image/image.cpp104
-rw-r--r--src/gui/doc/snippets/image/supportedformat.cpp52
-rw-r--r--src/gui/doc/snippets/matrix/matrix.cpp140
-rw-r--r--src/gui/doc/snippets/picture/picture.cpp151
-rw-r--r--src/gui/doc/snippets/polygon/polygon.cpp112
-rw-r--r--src/gui/doc/snippets/qfontdatabase/main.cpp74
-rw-r--r--src/gui/doc/snippets/qstatustipevent/main.cpp82
-rw-r--r--src/gui/doc/snippets/separations/finalwidget.cpp126
-rw-r--r--src/gui/doc/snippets/textblock-fragments/xmlwriter.cpp117
-rw-r--r--src/gui/doc/snippets/textdocument-css/main.cpp59
-rw-r--r--src/gui/doc/snippets/textdocument-listitemstyles/main.cpp52
-rw-r--r--src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.cpp84
-rw-r--r--src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.h65
-rw-r--r--src/gui/doc/snippets/textdocument-listitemstyles/textdocument-listitemstyles.pro3
-rw-r--r--src/gui/doc/snippets/textdocument-lists/mainwindow.cpp192
-rw-r--r--src/gui/doc/snippets/textdocument-resources/main.cpp83
-rw-r--r--src/gui/doc/snippets/textdocument-resources/textdocument-resources.pro1
-rw-r--r--src/gui/doc/snippets/textdocument-tables/mainwindow.cpp204
-rw-r--r--src/gui/doc/snippets/textdocument-texttable/main.cpp84
-rw-r--r--src/gui/doc/snippets/textdocumentendsnippet.cpp56
-rw-r--r--src/gui/doc/snippets/transform/main.cpp140
-rw-r--r--src/gui/doc/src/coordsys.qdoc461
-rw-r--r--src/gui/doc/src/paintsystem.qdoc560
-rw-r--r--src/gui/doc/src/qtgui.qdoc39
-rw-r--r--src/gui/image/qimage.cpp10
-rw-r--r--src/gui/image/qimagereader.cpp8
-rw-r--r--src/gui/image/qimagewriter.cpp6
-rw-r--r--src/gui/image/qmovie.cpp4
-rw-r--r--src/gui/image/qpicture.cpp18
-rw-r--r--src/gui/image/qpixmap.cpp8
-rw-r--r--src/gui/image/qpixmapcache.cpp4
-rw-r--r--src/gui/kernel/qclipboard.cpp6
-rw-r--r--src/gui/kernel/qdrag.cpp4
-rw-r--r--src/gui/kernel/qevent.cpp14
-rw-r--r--src/gui/kernel/qguiapplication.cpp4
-rw-r--r--src/gui/kernel/qkeysequence.cpp6
-rw-r--r--src/gui/kernel/qpalette.cpp2
-rw-r--r--src/gui/kernel/qshortcutmap.cpp2
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp6
-rw-r--r--src/gui/painting/qbrush.cpp8
-rw-r--r--src/gui/painting/qcolor.cpp2
-rw-r--r--src/gui/painting/qmatrix.cpp14
-rw-r--r--src/gui/painting/qpainter.cpp44
-rw-r--r--src/gui/painting/qpainterpath.cpp14
-rw-r--r--src/gui/painting/qpen.cpp8
-rw-r--r--src/gui/painting/qpolygon.cpp14
-rw-r--r--src/gui/painting/qregion.cpp4
-rw-r--r--src/gui/painting/qtransform.cpp14
-rw-r--r--src/gui/text/qfont.cpp10
-rw-r--r--src/gui/text/qfontdatabase.cpp4
-rw-r--r--src/gui/text/qfontmetrics.cpp4
-rw-r--r--src/gui/text/qsyntaxhighlighter.cpp10
-rw-r--r--src/gui/text/qtextcursor.cpp10
-rw-r--r--src/gui/text/qtextdocument.cpp10
-rw-r--r--src/gui/text/qtextdocumentwriter.cpp2
-rw-r--r--src/gui/text/qtextformat.cpp2
-rw-r--r--src/gui/text/qtextlayout.cpp4
-rw-r--r--src/gui/text/qtextlist.cpp2
-rw-r--r--src/gui/text/qtextobject.cpp4
-rw-r--r--src/gui/text/qtexttable.cpp8
-rw-r--r--src/gui/util/qdesktopservices.cpp6
-rw-r--r--src/gui/util/qvalidator.cpp10
221 files changed, 6157 insertions, 156 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index 02318468bb..6f1d505a4e 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -460,7 +460,7 @@ static void qAccessibleCleanup()
This is a typedef for a pointer to a function with the following
signature:
- \snippet doc/src/snippets/code/src_gui_accessible_qaccessible.cpp 1
+ \snippet code/src_gui_accessible_qaccessible.cpp 1
The function receives a QString and a QObject pointer, where the
QString is the key identifying the interface. The QObject is used
diff --git a/src/gui/doc/images/brush-outline.png b/src/gui/doc/images/brush-outline.png
new file mode 100644
index 0000000000..f560c9faf5
--- /dev/null
+++ b/src/gui/doc/images/brush-outline.png
Binary files differ
diff --git a/src/gui/doc/images/brush-styles.png b/src/gui/doc/images/brush-styles.png
new file mode 100644
index 0000000000..eecb006af1
--- /dev/null
+++ b/src/gui/doc/images/brush-styles.png
Binary files differ
diff --git a/src/gui/doc/images/coordinatesystem-analogclock.png b/src/gui/doc/images/coordinatesystem-analogclock.png
new file mode 100644
index 0000000000..16e3091b77
--- /dev/null
+++ b/src/gui/doc/images/coordinatesystem-analogclock.png
Binary files differ
diff --git a/src/gui/doc/images/coordinatesystem-line-antialias.png b/src/gui/doc/images/coordinatesystem-line-antialias.png
new file mode 100644
index 0000000000..90dfa8730e
--- /dev/null
+++ b/src/gui/doc/images/coordinatesystem-line-antialias.png
Binary files differ
diff --git a/src/gui/doc/images/coordinatesystem-line-raster.png b/src/gui/doc/images/coordinatesystem-line-raster.png
new file mode 100644
index 0000000000..65201bde9f
--- /dev/null
+++ b/src/gui/doc/images/coordinatesystem-line-raster.png
Binary files differ
diff --git a/src/gui/doc/images/coordinatesystem-line.png b/src/gui/doc/images/coordinatesystem-line.png
new file mode 100644
index 0000000000..fbf6873084
--- /dev/null
+++ b/src/gui/doc/images/coordinatesystem-line.png
Binary files differ
diff --git a/src/gui/doc/images/coordinatesystem-rect-antialias.png b/src/gui/doc/images/coordinatesystem-rect-antialias.png
new file mode 100644
index 0000000000..162e1df9cb
--- /dev/null
+++ b/src/gui/doc/images/coordinatesystem-rect-antialias.png
Binary files differ
diff --git a/src/gui/doc/images/coordinatesystem-rect-raster.png b/src/gui/doc/images/coordinatesystem-rect-raster.png
new file mode 100644
index 0000000000..be3690d6ad
--- /dev/null
+++ b/src/gui/doc/images/coordinatesystem-rect-raster.png
Binary files differ
diff --git a/src/gui/doc/images/coordinatesystem-rect.png b/src/gui/doc/images/coordinatesystem-rect.png
new file mode 100644
index 0000000000..76c06befd6
--- /dev/null
+++ b/src/gui/doc/images/coordinatesystem-rect.png
Binary files differ
diff --git a/src/gui/doc/images/coordinatesystem-transformations.png b/src/gui/doc/images/coordinatesystem-transformations.png
new file mode 100644
index 0000000000..2736213c07
--- /dev/null
+++ b/src/gui/doc/images/coordinatesystem-transformations.png
Binary files differ
diff --git a/src/gui/doc/images/cursor-arrow.png b/src/gui/doc/images/cursor-arrow.png
new file mode 100644
index 0000000000..a69ef4eb61
--- /dev/null
+++ b/src/gui/doc/images/cursor-arrow.png
Binary files differ
diff --git a/src/gui/doc/images/cursor-busy.png b/src/gui/doc/images/cursor-busy.png
new file mode 100644
index 0000000000..53717e4992
--- /dev/null
+++ b/src/gui/doc/images/cursor-busy.png
Binary files differ
diff --git a/src/gui/doc/images/cursor-closedhand.png b/src/gui/doc/images/cursor-closedhand.png
new file mode 100644
index 0000000000..b78dd1dac5
--- /dev/null
+++ b/src/gui/doc/images/cursor-closedhand.png
Binary files differ
diff --git a/src/gui/doc/images/cursor-cross.png b/src/gui/doc/images/cursor-cross.png
new file mode 100644
index 0000000000..fe38e74480
--- /dev/null
+++ b/src/gui/doc/images/cursor-cross.png
Binary files differ
diff --git a/src/gui/doc/images/cursor-forbidden.png b/src/gui/doc/images/cursor-forbidden.png
new file mode 100644
index 0000000000..2b08c4e2a3
--- /dev/null
+++ b/src/gui/doc/images/cursor-forbidden.png
Binary files differ
diff --git a/src/gui/doc/images/cursor-hand.png b/src/gui/doc/images/cursor-hand.png
new file mode 100644
index 0000000000..d2004aefa7
--- /dev/null
+++ b/src/gui/doc/images/cursor-hand.png
Binary files differ
diff --git a/src/gui/doc/images/cursor-hsplit.png b/src/gui/doc/images/cursor-hsplit.png
new file mode 100644
index 0000000000..a5667e3ffb
--- /dev/null
+++ b/src/gui/doc/images/cursor-hsplit.png
Binary files differ
diff --git a/src/gui/doc/images/cursor-ibeam.png b/src/gui/doc/images/cursor-ibeam.png
new file mode 100644
index 0000000000..097fc5fa72
--- /dev/null
+++ b/src/gui/doc/images/cursor-ibeam.png
Binary files differ
diff --git a/src/gui/doc/images/cursor-openhand.png b/src/gui/doc/images/cursor-openhand.png
new file mode 100644
index 0000000000..9181c859ed
--- /dev/null
+++ b/src/gui/doc/images/cursor-openhand.png
Binary files differ
diff --git a/src/gui/doc/images/cursor-sizeall.png b/src/gui/doc/images/cursor-sizeall.png
new file mode 100644
index 0000000000..69f13eb347
--- /dev/null
+++ b/src/gui/doc/images/cursor-sizeall.png
Binary files differ
diff --git a/src/gui/doc/images/cursor-sizeb.png b/src/gui/doc/images/cursor-sizeb.png
new file mode 100644
index 0000000000..f37d7b91e8
--- /dev/null
+++ b/src/gui/doc/images/cursor-sizeb.png
Binary files differ
diff --git a/src/gui/doc/images/cursor-sizef.png b/src/gui/doc/images/cursor-sizef.png
new file mode 100644
index 0000000000..3b127a05d3
--- /dev/null
+++ b/src/gui/doc/images/cursor-sizef.png
Binary files differ
diff --git a/src/gui/doc/images/cursor-sizeh.png b/src/gui/doc/images/cursor-sizeh.png
new file mode 100644
index 0000000000..a9f40cbc3d
--- /dev/null
+++ b/src/gui/doc/images/cursor-sizeh.png
Binary files differ
diff --git a/src/gui/doc/images/cursor-sizev.png b/src/gui/doc/images/cursor-sizev.png
new file mode 100644
index 0000000000..1edbab27a5
--- /dev/null
+++ b/src/gui/doc/images/cursor-sizev.png
Binary files differ
diff --git a/src/gui/doc/images/cursor-uparrow.png b/src/gui/doc/images/cursor-uparrow.png
new file mode 100644
index 0000000000..d3e70ef4c2
--- /dev/null
+++ b/src/gui/doc/images/cursor-uparrow.png
Binary files differ
diff --git a/src/gui/doc/images/cursor-vsplit.png b/src/gui/doc/images/cursor-vsplit.png
new file mode 100644
index 0000000000..1beda2570e
--- /dev/null
+++ b/src/gui/doc/images/cursor-vsplit.png
Binary files differ
diff --git a/src/gui/doc/images/cursor-wait.png b/src/gui/doc/images/cursor-wait.png
new file mode 100644
index 0000000000..69056c479e
--- /dev/null
+++ b/src/gui/doc/images/cursor-wait.png
Binary files differ
diff --git a/src/gui/doc/images/cursor-whatsthis.png b/src/gui/doc/images/cursor-whatsthis.png
new file mode 100644
index 0000000000..b47601c378
--- /dev/null
+++ b/src/gui/doc/images/cursor-whatsthis.png
Binary files differ
diff --git a/src/gui/doc/images/hoverevents.png b/src/gui/doc/images/hoverevents.png
new file mode 100644
index 0000000000..ccc079bdf1
--- /dev/null
+++ b/src/gui/doc/images/hoverevents.png
Binary files differ
diff --git a/src/gui/doc/images/paintsystem-antialiasing.png b/src/gui/doc/images/paintsystem-antialiasing.png
new file mode 100644
index 0000000000..1275841b93
--- /dev/null
+++ b/src/gui/doc/images/paintsystem-antialiasing.png
Binary files differ
diff --git a/src/gui/doc/images/paintsystem-core.png b/src/gui/doc/images/paintsystem-core.png
new file mode 100644
index 0000000000..7d6a8e591b
--- /dev/null
+++ b/src/gui/doc/images/paintsystem-core.png
Binary files differ
diff --git a/src/gui/doc/images/paintsystem-devices.png b/src/gui/doc/images/paintsystem-devices.png
new file mode 100644
index 0000000000..7b81b7cbb8
--- /dev/null
+++ b/src/gui/doc/images/paintsystem-devices.png
Binary files differ
diff --git a/src/gui/doc/images/paintsystem-fancygradient.png b/src/gui/doc/images/paintsystem-fancygradient.png
new file mode 100644
index 0000000000..701df29e42
--- /dev/null
+++ b/src/gui/doc/images/paintsystem-fancygradient.png
Binary files differ
diff --git a/src/gui/doc/images/paintsystem-gradients.png b/src/gui/doc/images/paintsystem-gradients.png
new file mode 100644
index 0000000000..50b2ed3671
--- /dev/null
+++ b/src/gui/doc/images/paintsystem-gradients.png
Binary files differ
diff --git a/src/gui/doc/images/paintsystem-icon.png b/src/gui/doc/images/paintsystem-icon.png
new file mode 100644
index 0000000000..4623db0761
--- /dev/null
+++ b/src/gui/doc/images/paintsystem-icon.png
Binary files differ
diff --git a/src/gui/doc/images/paintsystem-movie.png b/src/gui/doc/images/paintsystem-movie.png
new file mode 100644
index 0000000000..992ea9edd4
--- /dev/null
+++ b/src/gui/doc/images/paintsystem-movie.png
Binary files differ
diff --git a/src/gui/doc/images/paintsystem-painterpath.png b/src/gui/doc/images/paintsystem-painterpath.png
new file mode 100644
index 0000000000..f8154f2634
--- /dev/null
+++ b/src/gui/doc/images/paintsystem-painterpath.png
Binary files differ
diff --git a/src/gui/doc/images/paintsystem-stylepainter.png b/src/gui/doc/images/paintsystem-stylepainter.png
new file mode 100644
index 0000000000..a67c6c5afc
--- /dev/null
+++ b/src/gui/doc/images/paintsystem-stylepainter.png
Binary files differ
diff --git a/src/gui/doc/images/paintsystem-svg.png b/src/gui/doc/images/paintsystem-svg.png
new file mode 100644
index 0000000000..ecc8ef8f97
--- /dev/null
+++ b/src/gui/doc/images/paintsystem-svg.png
Binary files differ
diff --git a/src/gui/doc/images/qcolor-cmyk.png b/src/gui/doc/images/qcolor-cmyk.png
new file mode 100644
index 0000000000..dfe8f67a31
--- /dev/null
+++ b/src/gui/doc/images/qcolor-cmyk.png
Binary files differ
diff --git a/src/gui/doc/images/qcolor-hsv.png b/src/gui/doc/images/qcolor-hsv.png
new file mode 100644
index 0000000000..49fdf77222
--- /dev/null
+++ b/src/gui/doc/images/qcolor-hsv.png
Binary files differ
diff --git a/src/gui/doc/images/qcolor-hue.png b/src/gui/doc/images/qcolor-hue.png
new file mode 100644
index 0000000000..144b27c87a
--- /dev/null
+++ b/src/gui/doc/images/qcolor-hue.png
Binary files differ
diff --git a/src/gui/doc/images/qcolor-rgb.png b/src/gui/doc/images/qcolor-rgb.png
new file mode 100644
index 0000000000..fea4c63fd7
--- /dev/null
+++ b/src/gui/doc/images/qcolor-rgb.png
Binary files differ
diff --git a/src/gui/doc/images/qcolor-saturation.png b/src/gui/doc/images/qcolor-saturation.png
new file mode 100644
index 0000000000..f28776aff5
--- /dev/null
+++ b/src/gui/doc/images/qcolor-saturation.png
Binary files differ
diff --git a/src/gui/doc/images/qcolor-value.png b/src/gui/doc/images/qcolor-value.png
new file mode 100644
index 0000000000..0e069123a9
--- /dev/null
+++ b/src/gui/doc/images/qcolor-value.png
Binary files differ
diff --git a/src/gui/doc/images/qconicalgradient.png b/src/gui/doc/images/qconicalgradient.png
new file mode 100644
index 0000000000..82603066fb
--- /dev/null
+++ b/src/gui/doc/images/qconicalgradient.png
Binary files differ
diff --git a/src/gui/doc/images/qgradient-conical.png b/src/gui/doc/images/qgradient-conical.png
new file mode 100644
index 0000000000..cf06b70db6
--- /dev/null
+++ b/src/gui/doc/images/qgradient-conical.png
Binary files differ
diff --git a/src/gui/doc/images/qgradient-linear.png b/src/gui/doc/images/qgradient-linear.png
new file mode 100644
index 0000000000..5a5e880de7
--- /dev/null
+++ b/src/gui/doc/images/qgradient-linear.png
Binary files differ
diff --git a/src/gui/doc/images/qgradient-radial.png b/src/gui/doc/images/qgradient-radial.png
new file mode 100644
index 0000000000..95b9e9c3c9
--- /dev/null
+++ b/src/gui/doc/images/qgradient-radial.png
Binary files differ
diff --git a/src/gui/doc/images/qimage-32bit_scaled.png b/src/gui/doc/images/qimage-32bit_scaled.png
new file mode 100644
index 0000000000..6932327456
--- /dev/null
+++ b/src/gui/doc/images/qimage-32bit_scaled.png
Binary files differ
diff --git a/src/gui/doc/images/qimage-8bit_scaled.png b/src/gui/doc/images/qimage-8bit_scaled.png
new file mode 100644
index 0000000000..7cbf0f1e29
--- /dev/null
+++ b/src/gui/doc/images/qimage-8bit_scaled.png
Binary files differ
diff --git a/src/gui/doc/images/qimage-scaling.png b/src/gui/doc/images/qimage-scaling.png
new file mode 100644
index 0000000000..fcd71448f0
--- /dev/null
+++ b/src/gui/doc/images/qimage-scaling.png
Binary files differ
diff --git a/src/gui/doc/images/qlineargradient-pad.png b/src/gui/doc/images/qlineargradient-pad.png
new file mode 100644
index 0000000000..d77eb3dc3d
--- /dev/null
+++ b/src/gui/doc/images/qlineargradient-pad.png
Binary files differ
diff --git a/src/gui/doc/images/qlineargradient-reflect.png b/src/gui/doc/images/qlineargradient-reflect.png
new file mode 100644
index 0000000000..dd12665051
--- /dev/null
+++ b/src/gui/doc/images/qlineargradient-reflect.png
Binary files differ
diff --git a/src/gui/doc/images/qlineargradient-repeat.png b/src/gui/doc/images/qlineargradient-repeat.png
new file mode 100644
index 0000000000..e38203c438
--- /dev/null
+++ b/src/gui/doc/images/qlineargradient-repeat.png
Binary files differ
diff --git a/src/gui/doc/images/qmatrix-combinedtransformation.png b/src/gui/doc/images/qmatrix-combinedtransformation.png
new file mode 100644
index 0000000000..f791bfa917
--- /dev/null
+++ b/src/gui/doc/images/qmatrix-combinedtransformation.png
Binary files differ
diff --git a/src/gui/doc/images/qmatrix-representation.png b/src/gui/doc/images/qmatrix-representation.png
new file mode 100644
index 0000000000..2e3efd33fc
--- /dev/null
+++ b/src/gui/doc/images/qmatrix-representation.png
Binary files differ
diff --git a/src/gui/doc/images/qmatrix-simpletransformation.png b/src/gui/doc/images/qmatrix-simpletransformation.png
new file mode 100644
index 0000000000..dde8f4bc58
--- /dev/null
+++ b/src/gui/doc/images/qmatrix-simpletransformation.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-affinetransformations.png b/src/gui/doc/images/qpainter-affinetransformations.png
new file mode 100644
index 0000000000..fe2f9a072b
--- /dev/null
+++ b/src/gui/doc/images/qpainter-affinetransformations.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-arc.png b/src/gui/doc/images/qpainter-arc.png
new file mode 100644
index 0000000000..8cb9cec96b
--- /dev/null
+++ b/src/gui/doc/images/qpainter-arc.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-basicdrawing.png b/src/gui/doc/images/qpainter-basicdrawing.png
new file mode 100644
index 0000000000..3be48c8737
--- /dev/null
+++ b/src/gui/doc/images/qpainter-basicdrawing.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-chord.png b/src/gui/doc/images/qpainter-chord.png
new file mode 100644
index 0000000000..a8090861a0
--- /dev/null
+++ b/src/gui/doc/images/qpainter-chord.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-clock.png b/src/gui/doc/images/qpainter-clock.png
new file mode 100644
index 0000000000..3634754161
--- /dev/null
+++ b/src/gui/doc/images/qpainter-clock.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-compositiondemo.png b/src/gui/doc/images/qpainter-compositiondemo.png
new file mode 100644
index 0000000000..40f62c75be
--- /dev/null
+++ b/src/gui/doc/images/qpainter-compositiondemo.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-compositionmode1.png b/src/gui/doc/images/qpainter-compositionmode1.png
new file mode 100644
index 0000000000..6753093521
--- /dev/null
+++ b/src/gui/doc/images/qpainter-compositionmode1.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-compositionmode2.png b/src/gui/doc/images/qpainter-compositionmode2.png
new file mode 100644
index 0000000000..fc05afbd8c
--- /dev/null
+++ b/src/gui/doc/images/qpainter-compositionmode2.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-concentriccircles.png b/src/gui/doc/images/qpainter-concentriccircles.png
new file mode 100644
index 0000000000..4889dcd76d
--- /dev/null
+++ b/src/gui/doc/images/qpainter-concentriccircles.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-ellipse.png b/src/gui/doc/images/qpainter-ellipse.png
new file mode 100644
index 0000000000..e7e78c3dac
--- /dev/null
+++ b/src/gui/doc/images/qpainter-ellipse.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-gradients.png b/src/gui/doc/images/qpainter-gradients.png
new file mode 100644
index 0000000000..b7bc6a3270
--- /dev/null
+++ b/src/gui/doc/images/qpainter-gradients.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-line.png b/src/gui/doc/images/qpainter-line.png
new file mode 100644
index 0000000000..5f1cd97eff
--- /dev/null
+++ b/src/gui/doc/images/qpainter-line.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-painterpaths.png b/src/gui/doc/images/qpainter-painterpaths.png
new file mode 100644
index 0000000000..0762ca93f3
--- /dev/null
+++ b/src/gui/doc/images/qpainter-painterpaths.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-path.png b/src/gui/doc/images/qpainter-path.png
new file mode 100644
index 0000000000..3570b16d7a
--- /dev/null
+++ b/src/gui/doc/images/qpainter-path.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-pathstroking.png b/src/gui/doc/images/qpainter-pathstroking.png
new file mode 100644
index 0000000000..ab73c6ae01
--- /dev/null
+++ b/src/gui/doc/images/qpainter-pathstroking.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-pie.png b/src/gui/doc/images/qpainter-pie.png
new file mode 100644
index 0000000000..78039013e0
--- /dev/null
+++ b/src/gui/doc/images/qpainter-pie.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-polygon.png b/src/gui/doc/images/qpainter-polygon.png
new file mode 100644
index 0000000000..3b6ea3c797
--- /dev/null
+++ b/src/gui/doc/images/qpainter-polygon.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-rectangle.png b/src/gui/doc/images/qpainter-rectangle.png
new file mode 100644
index 0000000000..05fdc88300
--- /dev/null
+++ b/src/gui/doc/images/qpainter-rectangle.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-rotation.png b/src/gui/doc/images/qpainter-rotation.png
new file mode 100644
index 0000000000..6e24a0e040
--- /dev/null
+++ b/src/gui/doc/images/qpainter-rotation.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-roundrect.png b/src/gui/doc/images/qpainter-roundrect.png
new file mode 100644
index 0000000000..876a277811
--- /dev/null
+++ b/src/gui/doc/images/qpainter-roundrect.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-scale.png b/src/gui/doc/images/qpainter-scale.png
new file mode 100644
index 0000000000..4fe582eb13
--- /dev/null
+++ b/src/gui/doc/images/qpainter-scale.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-text.png b/src/gui/doc/images/qpainter-text.png
new file mode 100644
index 0000000000..e95c965d7b
--- /dev/null
+++ b/src/gui/doc/images/qpainter-text.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-translation.png b/src/gui/doc/images/qpainter-translation.png
new file mode 100644
index 0000000000..b3716ca3f6
--- /dev/null
+++ b/src/gui/doc/images/qpainter-translation.png
Binary files differ
diff --git a/src/gui/doc/images/qpainter-vectordeformation.png b/src/gui/doc/images/qpainter-vectordeformation.png
new file mode 100644
index 0000000000..aff95f404c
--- /dev/null
+++ b/src/gui/doc/images/qpainter-vectordeformation.png
Binary files differ
diff --git a/src/gui/doc/images/qpainterpath-addellipse.png b/src/gui/doc/images/qpainterpath-addellipse.png
new file mode 100644
index 0000000000..98f85174ef
--- /dev/null
+++ b/src/gui/doc/images/qpainterpath-addellipse.png
Binary files differ
diff --git a/src/gui/doc/images/qpainterpath-addpolygon.png b/src/gui/doc/images/qpainterpath-addpolygon.png
new file mode 100644
index 0000000000..d36bde8ada
--- /dev/null
+++ b/src/gui/doc/images/qpainterpath-addpolygon.png
Binary files differ
diff --git a/src/gui/doc/images/qpainterpath-addrectangle.png b/src/gui/doc/images/qpainterpath-addrectangle.png
new file mode 100644
index 0000000000..be9283e46d
--- /dev/null
+++ b/src/gui/doc/images/qpainterpath-addrectangle.png
Binary files differ
diff --git a/src/gui/doc/images/qpainterpath-addtext.png b/src/gui/doc/images/qpainterpath-addtext.png
new file mode 100644
index 0000000000..803a9581ac
--- /dev/null
+++ b/src/gui/doc/images/qpainterpath-addtext.png
Binary files differ
diff --git a/src/gui/doc/images/qpainterpath-arcto.png b/src/gui/doc/images/qpainterpath-arcto.png
new file mode 100644
index 0000000000..fe60b08d31
--- /dev/null
+++ b/src/gui/doc/images/qpainterpath-arcto.png
Binary files differ
diff --git a/src/gui/doc/images/qpainterpath-construction.png b/src/gui/doc/images/qpainterpath-construction.png
new file mode 100644
index 0000000000..4beeba1dd8
--- /dev/null
+++ b/src/gui/doc/images/qpainterpath-construction.png
Binary files differ
diff --git a/src/gui/doc/images/qpainterpath-cubicto.png b/src/gui/doc/images/qpainterpath-cubicto.png
new file mode 100644
index 0000000000..465bfeca29
--- /dev/null
+++ b/src/gui/doc/images/qpainterpath-cubicto.png
Binary files differ
diff --git a/src/gui/doc/images/qpainterpath-demo.png b/src/gui/doc/images/qpainterpath-demo.png
new file mode 100644
index 0000000000..ceeed2f170
--- /dev/null
+++ b/src/gui/doc/images/qpainterpath-demo.png
Binary files differ
diff --git a/src/gui/doc/images/qpainterpath-example.png b/src/gui/doc/images/qpainterpath-example.png
new file mode 100644
index 0000000000..f2bd359aba
--- /dev/null
+++ b/src/gui/doc/images/qpainterpath-example.png
Binary files differ
diff --git a/src/gui/doc/images/qpen-bevel.png b/src/gui/doc/images/qpen-bevel.png
new file mode 100644
index 0000000000..8a30779e3b
--- /dev/null
+++ b/src/gui/doc/images/qpen-bevel.png
Binary files differ
diff --git a/src/gui/doc/images/qpen-custom.png b/src/gui/doc/images/qpen-custom.png
new file mode 100644
index 0000000000..a2a038abe0
--- /dev/null
+++ b/src/gui/doc/images/qpen-custom.png
Binary files differ
diff --git a/src/gui/doc/images/qpen-dash.png b/src/gui/doc/images/qpen-dash.png
new file mode 100644
index 0000000000..67082c3758
--- /dev/null
+++ b/src/gui/doc/images/qpen-dash.png
Binary files differ
diff --git a/src/gui/doc/images/qpen-dashdot.png b/src/gui/doc/images/qpen-dashdot.png
new file mode 100644
index 0000000000..64b384660f
--- /dev/null
+++ b/src/gui/doc/images/qpen-dashdot.png
Binary files differ
diff --git a/src/gui/doc/images/qpen-dashdotdot.png b/src/gui/doc/images/qpen-dashdotdot.png
new file mode 100644
index 0000000000..ff1b2e69cd
--- /dev/null
+++ b/src/gui/doc/images/qpen-dashdotdot.png
Binary files differ
diff --git a/src/gui/doc/images/qpen-dashpattern.png b/src/gui/doc/images/qpen-dashpattern.png
new file mode 100644
index 0000000000..e33cf58d49
--- /dev/null
+++ b/src/gui/doc/images/qpen-dashpattern.png
Binary files differ
diff --git a/src/gui/doc/images/qpen-demo.png b/src/gui/doc/images/qpen-demo.png
new file mode 100644
index 0000000000..3ea5108802
--- /dev/null
+++ b/src/gui/doc/images/qpen-demo.png
Binary files differ
diff --git a/src/gui/doc/images/qpen-dot.png b/src/gui/doc/images/qpen-dot.png
new file mode 100644
index 0000000000..54e81c9469
--- /dev/null
+++ b/src/gui/doc/images/qpen-dot.png
Binary files differ
diff --git a/src/gui/doc/images/qpen-flat.png b/src/gui/doc/images/qpen-flat.png
new file mode 100644
index 0000000000..06e2195f73
--- /dev/null
+++ b/src/gui/doc/images/qpen-flat.png
Binary files differ
diff --git a/src/gui/doc/images/qpen-miter.png b/src/gui/doc/images/qpen-miter.png
new file mode 100644
index 0000000000..025e003979
--- /dev/null
+++ b/src/gui/doc/images/qpen-miter.png
Binary files differ
diff --git a/src/gui/doc/images/qpen-miterlimit.png b/src/gui/doc/images/qpen-miterlimit.png
new file mode 100644
index 0000000000..17a90725fb
--- /dev/null
+++ b/src/gui/doc/images/qpen-miterlimit.png
Binary files differ
diff --git a/src/gui/doc/images/qpen-roundcap.png b/src/gui/doc/images/qpen-roundcap.png
new file mode 100644
index 0000000000..77b22b2bab
--- /dev/null
+++ b/src/gui/doc/images/qpen-roundcap.png
Binary files differ
diff --git a/src/gui/doc/images/qpen-roundjoin.png b/src/gui/doc/images/qpen-roundjoin.png
new file mode 100644
index 0000000000..155e2aa8cc
--- /dev/null
+++ b/src/gui/doc/images/qpen-roundjoin.png
Binary files differ
diff --git a/src/gui/doc/images/qpen-solid.png b/src/gui/doc/images/qpen-solid.png
new file mode 100644
index 0000000000..e042b18017
--- /dev/null
+++ b/src/gui/doc/images/qpen-solid.png
Binary files differ
diff --git a/src/gui/doc/images/qpen-square.png b/src/gui/doc/images/qpen-square.png
new file mode 100644
index 0000000000..ebc5d1e329
--- /dev/null
+++ b/src/gui/doc/images/qpen-square.png
Binary files differ
diff --git a/src/gui/doc/images/qradialgradient-pad.png b/src/gui/doc/images/qradialgradient-pad.png
new file mode 100644
index 0000000000..6c1a6cb268
--- /dev/null
+++ b/src/gui/doc/images/qradialgradient-pad.png
Binary files differ
diff --git a/src/gui/doc/images/qradialgradient-reflect.png b/src/gui/doc/images/qradialgradient-reflect.png
new file mode 100644
index 0000000000..5122b180b1
--- /dev/null
+++ b/src/gui/doc/images/qradialgradient-reflect.png
Binary files differ
diff --git a/src/gui/doc/images/qradialgradient-repeat.png b/src/gui/doc/images/qradialgradient-repeat.png
new file mode 100644
index 0000000000..aa639b7779
--- /dev/null
+++ b/src/gui/doc/images/qradialgradient-repeat.png
Binary files differ
diff --git a/src/gui/doc/images/qstatustipevent-action.png b/src/gui/doc/images/qstatustipevent-action.png
new file mode 100644
index 0000000000..c5dcfd25f5
--- /dev/null
+++ b/src/gui/doc/images/qstatustipevent-action.png
Binary files differ
diff --git a/src/gui/doc/images/qstatustipevent-widget.png b/src/gui/doc/images/qstatustipevent-widget.png
new file mode 100644
index 0000000000..3cc0a1f01b
--- /dev/null
+++ b/src/gui/doc/images/qstatustipevent-widget.png
Binary files differ
diff --git a/src/gui/doc/images/qt-fillrule-oddeven.png b/src/gui/doc/images/qt-fillrule-oddeven.png
new file mode 100644
index 0000000000..f39d1056f5
--- /dev/null
+++ b/src/gui/doc/images/qt-fillrule-oddeven.png
Binary files differ
diff --git a/src/gui/doc/images/qt-fillrule-winding.png b/src/gui/doc/images/qt-fillrule-winding.png
new file mode 100644
index 0000000000..8018248331
--- /dev/null
+++ b/src/gui/doc/images/qt-fillrule-winding.png
Binary files differ
diff --git a/src/gui/doc/images/qtexttableformat-cell.png b/src/gui/doc/images/qtexttableformat-cell.png
new file mode 100644
index 0000000000..bbf85ffe46
--- /dev/null
+++ b/src/gui/doc/images/qtexttableformat-cell.png
Binary files differ
diff --git a/src/gui/doc/images/qtransform-combinedtransformation.png b/src/gui/doc/images/qtransform-combinedtransformation.png
new file mode 100644
index 0000000000..df1e226746
--- /dev/null
+++ b/src/gui/doc/images/qtransform-combinedtransformation.png
Binary files differ
diff --git a/src/gui/doc/images/qtransform-combinedtransformation2.png b/src/gui/doc/images/qtransform-combinedtransformation2.png
new file mode 100644
index 0000000000..c037a0d565
--- /dev/null
+++ b/src/gui/doc/images/qtransform-combinedtransformation2.png
Binary files differ
diff --git a/src/gui/doc/images/qtransform-representation.png b/src/gui/doc/images/qtransform-representation.png
new file mode 100644
index 0000000000..883d5dc487
--- /dev/null
+++ b/src/gui/doc/images/qtransform-representation.png
Binary files differ
diff --git a/src/gui/doc/images/qtransform-simpletransformation.png b/src/gui/doc/images/qtransform-simpletransformation.png
new file mode 100644
index 0000000000..743e4e3e07
--- /dev/null
+++ b/src/gui/doc/images/qtransform-simpletransformation.png
Binary files differ
diff --git a/src/gui/doc/images/texttable-merge.png b/src/gui/doc/images/texttable-merge.png
new file mode 100644
index 0000000000..3b32239a42
--- /dev/null
+++ b/src/gui/doc/images/texttable-merge.png
Binary files differ
diff --git a/src/gui/doc/images/texttable-split.png b/src/gui/doc/images/texttable-split.png
new file mode 100644
index 0000000000..2fa17b85a3
--- /dev/null
+++ b/src/gui/doc/images/texttable-split.png
Binary files differ
diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf
new file mode 100644
index 0000000000..85772bbc3e
--- /dev/null
+++ b/src/gui/doc/qtgui.qdocconf
@@ -0,0 +1,92 @@
+include(../../../doc/global/qt-cpp-ignore.qdocconf)
+
+project = QtGui
+description = Qt GUI Reference Documentation
+url = http://qt-project.org/doc/qt-5.0/qtgui
+version = 5.0.0
+
+sourceencoding = UTF-8
+outputencoding = UTF-8
+naturallanguage = en_US
+qhp.projects = QtGui
+
+qhp.QtGui.file = qtgui.qhp
+qhp.QtGui.namespace = org.qt-project.qtgui.500
+qhp.QtGui.virtualFolder = qdoc
+qhp.QtGui.indexTitle = Qt GUI Reference Documentation
+qhp.QtGui.indexRoot =
+
+qhp.QtGui.filterAttributes = qtgui 5.0.0 qtrefdoc
+qhp.QtGui.customFilters.Qt.name = Qtgui 5.0.0
+qhp.QtGui.customFilters.Qt.filterAttributes = qtgui 5.0.0
+qhp.QtGui.subprojects = classes overviews examples
+qhp.QtGui.subprojects.classes.title = Classes
+qhp.QtGui.subprojects.classes.indexTitle = Qt GUI's Classes
+qhp.QtGui.subprojects.classes.selectors = class fake:headerfile
+qhp.QtGui.subprojects.classes.sortPages = true
+qhp.QtGui.subprojects.overviews.title = Overviews
+qhp.QtGui.subprojects.overviews.indexTitle = All Overviews and HOWTOs
+qhp.QtGui.subprojects.overviews.selectors = fake:page,group,module
+qhp.QtGui.subprojects.examples.title = Qt GUI Examples
+qhp.QtGui.subprojects.examples.indexTitle = Qt GUI Examples
+qhp.QtGui.subprojects.examples.selectors = fake:example
+
+dita.metadata.default.author = Qt Project
+dita.metadata.default.permissions = all
+dita.metadata.default.publisher = Qt Project
+dita.metadata.default.copyryear = 2012
+dita.metadata.default.copyrholder = Nokia
+dita.metadata.default.audience = programmer
+
+sources.fileextensions = "*.c++ *.cc *.cpp *.cxx *.mm *.qml *.qdoc"
+headers.fileextensions = "*.ch *.h *.h++ *.hh *.hpp *.hxx"
+
+examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml *.css"
+examples.imageextensions = "*.png"
+
+outputdir = ../../../doc/qtgui
+tagfile = ../../../doc/qtgui/qtgui.tags
+
+HTML.generatemacrefs = "true"
+HTML.nobreadcrumbs = "true"
+
+HTML.templatedir = .
+
+HTML.stylesheets = ../../../doc/global/style/offline.css
+
+HTML.headerstyles = \
+ " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/offline.css\" />\n"
+
+HTML.endheader = \
+ "</head>\n" \
+
+defines = Q_QDOC \
+ QT_.*_SUPPORT \
+ QT_.*_LIB \
+ QT_COMPAT \
+ QT_KEYPAD_NAVIGATION \
+ QT_NO_EGL \
+ Q_WS_.* \
+ Q_OS_.* \
+ Q_BYTE_ORDER \
+ QT_DEPRECATED \
+ QT_DEPRECATED_* \
+ Q_NO_USING_KEYWORD \
+ __cplusplus \
+ Q_COMPILER_INITIALIZER_LISTS
+
+versionsym = QT_VERSION_STR
+
+codeindent = 1
+
+depends += qtcore
+
+headerdirs += ..
+
+sourcedirs += ..
+
+exampledirs += ../../../examples \
+ ../ \
+ snippets
+
+imagedirs += images
diff --git a/src/gui/doc/snippets/brush/brush.cpp b/src/gui/doc/snippets/brush/brush.cpp
new file mode 100644
index 0000000000..a92223ee93
--- /dev/null
+++ b/src/gui/doc/snippets/brush/brush.cpp
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+
+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/src/gui/doc/snippets/brush/gradientcreationsnippet.cpp b/src/gui/doc/snippets/brush/gradientcreationsnippet.cpp
new file mode 100644
index 0000000000..9ec8c3f07a
--- /dev/null
+++ b/src/gui/doc/snippets/brush/gradientcreationsnippet.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+
+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/src/gui/doc/snippets/code/doc_src_qtgui.pro b/src/gui/doc/snippets/code/doc_src_qtgui.pro
new file mode 100644
index 0000000000..51bb6c74ff
--- /dev/null
+++ b/src/gui/doc/snippets/code/doc_src_qtgui.pro
@@ -0,0 +1,3 @@
+#! [0]
+#include <QtGui>
+#! [0]
diff --git a/src/gui/doc/snippets/code/src_gui_accessible_qaccessible.cpp b/src/gui/doc/snippets/code/src_gui_accessible_qaccessible.cpp
new file mode 100644
index 0000000000..f12f55051e
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_accessible_qaccessible.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_image_qimage.cpp b/src/gui/doc/snippets/code/src_gui_image_qimage.cpp
new file mode 100644
index 0000000000..0c39e22eb6
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_image_qimage.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_image_qimagereader.cpp b/src/gui/doc/snippets/code/src_gui_image_qimagereader.cpp
new file mode 100644
index 0000000000..92f528e6c0
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_image_qimagereader.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_image_qimagewriter.cpp b/src/gui/doc/snippets/code/src_gui_image_qimagewriter.cpp
new file mode 100644
index 0000000000..d0f11929d3
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_image_qimagewriter.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_image_qmovie.cpp b/src/gui/doc/snippets/code/src_gui_image_qmovie.cpp
new file mode 100644
index 0000000000..5d57d19204
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_image_qmovie.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp b/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp
new file mode 100644
index 0000000000..b8c0fcfbd5
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_image_qpixmapcache.cpp b/src/gui/doc/snippets/code/src_gui_image_qpixmapcache.cpp
new file mode 100644
index 0000000000..9d42f6b330
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_image_qpixmapcache.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp
new file mode 100644
index 0000000000..b32e8c3f39
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp
@@ -0,0 +1,183 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_kernel_qapplication_x11.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qapplication_x11.cpp
new file mode 100644
index 0000000000..1d37765e3c
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qapplication_x11.cpp
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_kernel_qclipboard.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qclipboard.cpp
new file mode 100644
index 0000000000..4cf8f33c02
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qclipboard.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_kernel_qevent.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qevent.cpp
new file mode 100644
index 0000000000..d8bdeebe84
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qevent.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_kernel_qkeysequence.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qkeysequence.cpp
new file mode 100644
index 0000000000..79dc967cf3
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qkeysequence.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_kernel_qshortcutmap.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qshortcutmap.cpp
new file mode 100644
index 0000000000..d761e31d3d
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qshortcutmap.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_painting_qbrush.cpp b/src/gui/doc/snippets/code/src_gui_painting_qbrush.cpp
new file mode 100644
index 0000000000..8678c48d62
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_painting_qbrush.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_painting_qcolor.cpp b/src/gui/doc/snippets/code/src_gui_painting_qcolor.cpp
new file mode 100644
index 0000000000..8954fed604
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_painting_qcolor.cpp
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_painting_qmatrix.cpp b/src/gui/doc/snippets/code/src_gui_painting_qmatrix.cpp
new file mode 100644
index 0000000000..d4e1b57b3c
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_painting_qmatrix.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp b/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp
new file mode 100644
index 0000000000..8caffa46f4
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp
@@ -0,0 +1,259 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_painting_qpainterpath.cpp b/src/gui/doc/snippets/code/src_gui_painting_qpainterpath.cpp
new file mode 100644
index 0000000000..b23f8cea23
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_painting_qpainterpath.cpp
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_painting_qpen.cpp b/src/gui/doc/snippets/code/src_gui_painting_qpen.cpp
new file mode 100644
index 0000000000..4da729b88d
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_painting_qpen.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** 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<qreal> dashes;
+qreal space = 4;
+
+dashes << 1 << space << 3 << space << 9 << space
+ << 27 << space << 9 << space;
+
+pen.setDashPattern(dashes);
+//! [2]
+
+
+//! [3]
+QPen pen;
+QVector<qreal> dashes;
+qreal space = 4;
+dashes << 1 << space << 3 << space << 9 << space
+ << 27 << space << 9 << space;
+pen.setDashPattern(dashes);
+//! [3]
diff --git a/src/gui/doc/snippets/code/src_gui_painting_qregion.cpp b/src/gui/doc/snippets/code/src_gui_painting_qregion.cpp
new file mode 100644
index 0000000000..8f334c5695
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_painting_qregion.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_painting_qregion_unix.cpp b/src/gui/doc/snippets/code/src_gui_painting_qregion_unix.cpp
new file mode 100644
index 0000000000..63b9de19d1
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_painting_qregion_unix.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_painting_qtransform.cpp b/src/gui/doc/snippets/code/src_gui_painting_qtransform.cpp
new file mode 100644
index 0000000000..f54e0a07ca
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_painting_qtransform.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_qopenglshaderprogram.cpp b/src/gui/doc/snippets/code/src_gui_qopenglshaderprogram.cpp
new file mode 100644
index 0000000000..637527036f
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_qopenglshaderprogram.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_text_qfont.cpp b/src/gui/doc/snippets/code/src_gui_text_qfont.cpp
new file mode 100644
index 0000000000..fab550cbc7
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_text_qfont.cpp
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp b/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp
new file mode 100644
index 0000000000..b864b4ddcc
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_text_qsyntaxhighlighter.cpp b/src/gui/doc/snippets/code/src_gui_text_qsyntaxhighlighter.cpp
new file mode 100644
index 0000000000..3fb6b35bb9
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_text_qsyntaxhighlighter.cpp
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** 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<ParenthesisInfo> parentheses;
+};
+//! [4]
diff --git a/src/gui/doc/snippets/code/src_gui_text_qtextcursor.cpp b/src/gui/doc/snippets/code/src_gui_text_qtextcursor.cpp
new file mode 100644
index 0000000000..7954f66cbd
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_text_qtextcursor.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_text_qtextdocument.cpp b/src/gui/doc/snippets/code/src_gui_text_qtextdocument.cpp
new file mode 100644
index 0000000000..23ebf8b2d2
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_text_qtextdocument.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** 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]
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>...
+//! [0]
diff --git a/src/gui/doc/snippets/code/src_gui_text_qtextdocumentwriter.cpp b/src/gui/doc/snippets/code/src_gui_text_qtextdocumentwriter.cpp
new file mode 100644
index 0000000000..59ef46c422
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_text_qtextdocumentwriter.cpp
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_text_qtextlayout.cpp b/src/gui/doc/snippets/code/src_gui_text_qtextlayout.cpp
new file mode 100644
index 0000000000..c8e1d2e010
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_text_qtextlayout.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_util_qdesktopservices.cpp b/src/gui/doc/snippets/code/src_gui_util_qdesktopservices.cpp
new file mode 100644
index 0000000000..0b4739841b
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_util_qdesktopservices.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/code/src_gui_util_qvalidator.cpp b/src/gui/doc/snippets/code/src_gui_util_qvalidator.cpp
new file mode 100644
index 0000000000..2f769c5860
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_util_qvalidator.cpp
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/snippets/dragging/mainwindow.cpp b/src/gui/doc/snippets/dragging/mainwindow.cpp
new file mode 100644
index 0000000000..57f1abc22d
--- /dev/null
+++ b/src/gui/doc/snippets/dragging/mainwindow.cpp
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+
+#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("<p>Drag the icon to a filer "
+ "window or the desktop background:</p>"),
+ 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/src/gui/doc/snippets/droparea.cpp b/src/gui/doc/snippets/droparea.cpp
new file mode 100644
index 0000000000..27d52d1b89
--- /dev/null
+++ b/src/gui/doc/snippets/droparea.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+
+#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("<drop content>"));
+ 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<QPixmap>(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<QPixmap>(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("<drop content>"));
+ setBackgroundRole(QPalette::Dark);
+
+ emit changed();
+}
+
+QPixmap DropArea::extractPixmap(const QByteArray &data, const QString &format)
+{
+ QList<QByteArray> 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/src/gui/doc/snippets/image/image.cpp b/src/gui/doc/snippets/image/image.cpp
new file mode 100644
index 0000000000..1dfe41f8cd
--- /dev/null
+++ b/src/gui/doc/snippets/image/image.cpp
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+
+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<uint *>(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/src/gui/doc/snippets/image/supportedformat.cpp b/src/gui/doc/snippets/image/supportedformat.cpp
new file mode 100644
index 0000000000..6d481908e8
--- /dev/null
+++ b/src/gui/doc/snippets/image/supportedformat.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+
+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/src/gui/doc/snippets/matrix/matrix.cpp b/src/gui/doc/snippets/matrix/matrix.cpp
new file mode 100644
index 0000000000..2aa2606fc6
--- /dev/null
+++ b/src/gui/doc/snippets/matrix/matrix.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+#include <cmath>
+
+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/src/gui/doc/snippets/picture/picture.cpp b/src/gui/doc/snippets/picture/picture.cpp
new file mode 100644
index 0000000000..8de5e32323
--- /dev/null
+++ b/src/gui/doc/snippets/picture/picture.cpp
@@ -0,0 +1,151 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+
+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/src/gui/doc/snippets/polygon/polygon.cpp b/src/gui/doc/snippets/polygon/polygon.cpp
new file mode 100644
index 0000000000..432156f8e6
--- /dev/null
+++ b/src/gui/doc/snippets/polygon/polygon.cpp
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+
+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/src/gui/doc/snippets/qfontdatabase/main.cpp b/src/gui/doc/snippets/qfontdatabase/main.cpp
new file mode 100644
index 0000000000..8e98e309a0
--- /dev/null
+++ b/src/gui/doc/snippets/qfontdatabase/main.cpp
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+
+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/src/gui/doc/snippets/qstatustipevent/main.cpp b/src/gui/doc/snippets/qstatustipevent/main.cpp
new file mode 100644
index 0000000000..9a1948f4e8
--- /dev/null
+++ b/src/gui/doc/snippets/qstatustipevent/main.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+#include <QApplication>
+
+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/src/gui/doc/snippets/separations/finalwidget.cpp b/src/gui/doc/snippets/separations/finalwidget.cpp
new file mode 100644
index 0000000000..81a4aa1c42
--- /dev/null
+++ b/src/gui/doc/snippets/separations/finalwidget.cpp
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+#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/src/gui/doc/snippets/textblock-fragments/xmlwriter.cpp b/src/gui/doc/snippets/textblock-fragments/xmlwriter.cpp
new file mode 100644
index 0000000000..cd9beadd00
--- /dev/null
+++ b/src/gui/doc/snippets/textblock-fragments/xmlwriter.cpp
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+
+#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 &currentBlock,
+ 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 &currentBlock)
+{
+}
+
+void XmlWriter::processFragment(const QTextFragment &currentFragment)
+{
+}
diff --git a/src/gui/doc/snippets/textdocument-css/main.cpp b/src/gui/doc/snippets/textdocument-css/main.cpp
new file mode 100644
index 0000000000..55b8571224
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-css/main.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+
+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/src/gui/doc/snippets/textdocument-listitemstyles/main.cpp b/src/gui/doc/snippets/textdocument-listitemstyles/main.cpp
new file mode 100644
index 0000000000..223ec22bae
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-listitemstyles/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+
+#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/src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.cpp b/src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.cpp
new file mode 100644
index 0000000000..029695eca3
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+
+#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/src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.h b/src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.h
new file mode 100644
index 0000000000..fc5c6db2a7
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** 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 <QMainWindow>
+
+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/src/gui/doc/snippets/textdocument-listitemstyles/textdocument-listitemstyles.pro b/src/gui/doc/snippets/textdocument-listitemstyles/textdocument-listitemstyles.pro
new file mode 100644
index 0000000000..5da8d6e1a1
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-listitemstyles/textdocument-listitemstyles.pro
@@ -0,0 +1,3 @@
+HEADERS = mainwindow.h
+SOURCES = main.cpp \
+ mainwindow.cpp
diff --git a/src/gui/doc/snippets/textdocument-lists/mainwindow.cpp b/src/gui/doc/snippets/textdocument-lists/mainwindow.cpp
new file mode 100644
index 0000000000..7ae36b0ced
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-lists/mainwindow.cpp
@@ -0,0 +1,192 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+
+#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/src/gui/doc/snippets/textdocument-resources/main.cpp b/src/gui/doc/snippets/textdocument-resources/main.cpp
new file mode 100644
index 0000000000..ed26793d78
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-resources/main.cpp
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+
+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("<img src=\"mydata://image.png\" />");
+//! [Inserting an image using HTML]
+
+ return app.exec();
+}
diff --git a/src/gui/doc/snippets/textdocument-resources/textdocument-resources.pro b/src/gui/doc/snippets/textdocument-resources/textdocument-resources.pro
new file mode 100644
index 0000000000..16181f21cf
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-resources/textdocument-resources.pro
@@ -0,0 +1 @@
+SOURCES = main.cpp
diff --git a/src/gui/doc/snippets/textdocument-tables/mainwindow.cpp b/src/gui/doc/snippets/textdocument-tables/mainwindow.cpp
new file mode 100644
index 0000000000..79e5f03df4
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-tables/mainwindow.cpp
@@ -0,0 +1,204 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+
+#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<QTextLength> 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/src/gui/doc/snippets/textdocument-texttable/main.cpp b/src/gui/doc/snippets/textdocument-texttable/main.cpp
new file mode 100644
index 0000000000..ca5338533c
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-texttable/main.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+
+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/src/gui/doc/snippets/textdocumentendsnippet.cpp b/src/gui/doc/snippets/textdocumentendsnippet.cpp
new file mode 100644
index 0000000000..caec20dc9b
--- /dev/null
+++ b/src/gui/doc/snippets/textdocumentendsnippet.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+#include <iostream.h>
+
+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/src/gui/doc/snippets/transform/main.cpp b/src/gui/doc/snippets/transform/main.cpp
new file mode 100644
index 0000000000..d1c600828d
--- /dev/null
+++ b/src/gui/doc/snippets/transform/main.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** 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 <QtGui>
+#include <cmath>
+
+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();
+}
diff --git a/src/gui/doc/src/coordsys.qdoc b/src/gui/doc/src/coordsys.qdoc
new file mode 100644
index 0000000000..655dbf7cf3
--- /dev/null
+++ b/src/gui/doc/src/coordsys.qdoc
@@ -0,0 +1,461 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/src/paintsystem.qdoc b/src/gui/doc/src/paintsystem.qdoc
new file mode 100644
index 0000000000..4b33e4fed3
--- /dev/null
+++ b/src/gui/doc/src/paintsystem.qdoc
@@ -0,0 +1,560 @@
+/****************************************************************************
+**
+** 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/src/gui/doc/src/qtgui.qdoc b/src/gui/doc/src/qtgui.qdoc
new file mode 100644
index 0000000000..7e11aa5233
--- /dev/null
+++ b/src/gui/doc/src/qtgui.qdoc
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** 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 code/doc_src_qtgui.pro 0
+*/
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index b8ec7de851..64decd0fd7 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -441,7 +441,7 @@ bool QImageData::checkForAlphaPixels() const
\row
\li \inlineimage qimage-32bit_scaled.png
\li
- \snippet doc/src/snippets/code/src_gui_image_qimage.cpp 0
+ \snippet code/src_gui_image_qimage.cpp 0
\endtable
In case of a 8-bit and monchrome images, the pixel value is only
@@ -462,7 +462,7 @@ bool QImageData::checkForAlphaPixels() const
\row
\li \inlineimage qimage-8bit_scaled.png
\li
- \snippet doc/src/snippets/code/src_gui_image_qimage.cpp 1
+ \snippet code/src_gui_image_qimage.cpp 1
\endtable
QImage also provide the scanLine() function which returns a
@@ -949,7 +949,7 @@ extern bool qt_read_xpm_image_or_array(QIODevice *device, const char * const *so
Note that it's possible to squeeze the XPM variable a little bit
by using an unusual declaration:
- \snippet doc/src/snippets/code/src_gui_image_qimage.cpp 2
+ \snippet code/src_gui_image_qimage.cpp 2
The extra \c const makes the entire definition read-only, which is
slightly more efficient (e.g., when the code is in a shared
@@ -4478,7 +4478,7 @@ bool QImage::save(const QString &fileName, const char *format, int quality) cons
This can, for example, be used to save an image directly into a
QByteArray:
- \snippet doc/src/snippets/image/image.cpp 0
+ \snippet image/image.cpp 0
*/
bool QImage::save(QIODevice* device, const char* format, int quality) const
@@ -4801,7 +4801,7 @@ QString QImage::text(const QString &key) const
if a specific image or format supports embedding text
by using QImageWriter::supportsOption(). We give an example:
- \snippet doc/src/snippets/image/supportedformat.cpp 0
+ \snippet image/supportedformat.cpp 0
You can use QImageWriter::supportedImageFormats() to find out
which image formats are available to you.
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index fe14a45dcb..c08ac0593b 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -653,7 +653,7 @@ QImageReader::~QImageReader()
Sets the format QImageReader will use when reading images, to \a
format. \a format is a case insensitive text string. Example:
- \snippet doc/src/snippets/code/src_gui_image_qimagereader.cpp 0
+ \snippet code/src_gui_image_qimagereader.cpp 0
You can call supportedImageFormats() for the full list of formats
QImageReader supports.
@@ -671,7 +671,7 @@ void QImageReader::setFormat(const QByteArray &format)
You can call this function after assigning a device to the
reader to determine the format of the device. For example:
- \snippet doc/src/snippets/code/src_gui_image_qimagereader.cpp 1
+ \snippet code/src_gui_image_qimagereader.cpp 1
If the reader cannot read any image from the device (e.g., there is no
image there, or the image has already been read), or if the format is
@@ -1131,7 +1131,7 @@ QImage QImageReader::read()
which always constructs a new image; especially when reading several
images with the same format and size.
- \snippet doc/src/snippets/code/src_gui_image_qimagereader.cpp 2
+ \snippet code/src_gui_image_qimagereader.cpp 2
For image formats that support animation, calling read() repeatedly will
return the next frame. When all frames have been read, a null image will
@@ -1371,7 +1371,7 @@ QString QImageReader::errorString() const
(see text()), and the BMP format allows you to determine the image's size
without loading the whole image into memory (see size()).
- \snippet doc/src/snippets/code/src_gui_image_qimagereader.cpp 3
+ \snippet code/src_gui_image_qimagereader.cpp 3
\sa QImageWriter::supportsOption()
*/
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index 8395f9d216..56c459ee4d 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -323,7 +323,7 @@ QImageWriter::~QImageWriter()
Sets the format QImageWriter will use when writing images, to \a
format. \a format is a case insensitive text string. Example:
- \snippet doc/src/snippets/code/src_gui_image_qimagewriter.cpp 0
+ \snippet code/src_gui_image_qimagewriter.cpp 0
You can call supportedImageFormats() for the full list of formats
QImageWriter supports.
@@ -522,7 +522,7 @@ QString QImageWriter::description() const
\a text. This is useful for storing copyright information
or other information about the image. Example:
- \snippet doc/src/snippets/code/src_gui_image_qimagewriter.cpp 1
+ \snippet code/src_gui_image_qimagewriter.cpp 1
If you want to store a single block of data
(e.g., a comment), you can pass an empty key, or use
@@ -629,7 +629,7 @@ QString QImageWriter::errorString() const
example, the PNG format allows you to embed text into the image's metadata
(see text()).
- \snippet doc/src/snippets/code/src_gui_image_qimagewriter.cpp 2
+ \snippet code/src_gui_image_qimagewriter.cpp 2
Options can be tested after the writer has been associated with a format.
diff --git a/src/gui/image/qmovie.cpp b/src/gui/image/qmovie.cpp
index 8dfcf57dfd..e1ddcf1a0c 100644
--- a/src/gui/image/qmovie.cpp
+++ b/src/gui/image/qmovie.cpp
@@ -61,7 +61,7 @@
To display the movie in your application, you can pass your QMovie object
to QLabel::setMovie(). Example:
- \snippet doc/src/snippets/code/src_gui_image_qmovie.cpp 0
+ \snippet code/src_gui_image_qmovie.cpp 0
Whenever a new frame is available in the movie, QMovie will emit
updated(). If the size of the frame changes, resized() is emitted. You can
@@ -883,7 +883,7 @@ void QMovie::setPaused(bool paused)
The default speed is 100%.
Example:
- \snippet doc/src/snippets/code/src_gui_image_qmovie.cpp 1
+ \snippet code/src_gui_image_qmovie.cpp 1
*/
void QMovie::setSpeed(int percentSpeed)
{
diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp
index 8bb9f211e8..283002b1d3 100644
--- a/src/gui/image/qpicture.cpp
+++ b/src/gui/image/qpicture.cpp
@@ -92,13 +92,13 @@ void qt_format_text(const QFont &fnt, const QRectF &_r,
depending on the window system.
Example of how to record a picture:
- \snippet doc/src/snippets/picture/picture.cpp 0
+ \snippet picture/picture.cpp 0
Note that the list of painter commands is reset on each call to
the QPainter::begin() function.
Example of how to replay a picture:
- \snippet doc/src/snippets/picture/picture.cpp 1
+ \snippet picture/picture.cpp 1
Pictures can also be drawn using play(). Some basic data about a
picture is available, for example, size(), isNull() and
@@ -1226,7 +1226,7 @@ static QStringList qToStringList(const QList<QByteArray> arr)
Note that if you want to iterate over the list, you should iterate
over a copy, e.g.
- \snippet doc/src/snippets/picture/picture.cpp 2
+ \snippet picture/picture.cpp 2
\sa outputFormatList() inputFormats() QPictureIO
*/
@@ -1244,7 +1244,7 @@ QStringList QPicture::inputFormatList()
Note that if you want to iterate over the list, you should iterate
over a copy, e.g.
- \snippet doc/src/snippets/picture/picture.cpp 3
+ \snippet picture/picture.cpp 3
\sa inputFormatList() outputFormats() QPictureIO
*/
@@ -1464,11 +1464,11 @@ static QPictureHandler *get_picture_handler(const char *format)
both are null, the QPictureIO object is valid but useless.
Example:
- \snippet doc/src/snippets/picture/picture.cpp 6
+ \snippet picture/picture.cpp 6
\codeline
- \snippet doc/src/snippets/picture/picture.cpp 7
+ \snippet picture/picture.cpp 7
\codeline
- \snippet doc/src/snippets/picture/picture.cpp 8
+ \snippet picture/picture.cpp 8
Before the regular expression test, all the 0 bytes in the file header are
converted to 1 bytes. This is done because when Qt was ASCII-based, QRegExp
@@ -1833,7 +1833,7 @@ QList<QByteArray> QPictureIO::outputFormats()
Example:
- \snippet doc/src/snippets/picture/picture.cpp 4
+ \snippet picture/picture.cpp 4
\sa setIODevice() setFileName() setFormat() write() QPixmap::load()
*/
@@ -1902,7 +1902,7 @@ bool QPictureIO::read()
The picture will be written using the specified picture format.
Example:
- \snippet doc/src/snippets/picture/picture.cpp 5
+ \snippet picture/picture.cpp 5
\sa setIODevice() setFileName() setFormat() read() QPixmap::save()
*/
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index cefb8edf74..377d7e036a 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -241,7 +241,7 @@ QPixmap::QPixmap(const QPixmap &pixmap)
Note that it's possible to squeeze the XPM variable a little bit
by using an unusual declaration:
- \snippet doc/src/snippets/code/src_gui_image_qpixmap.cpp 0
+ \snippet code/src_gui_image_qpixmap.cpp 0
The extra \c const makes the entire definition read-only, which is
slightly more efficient (for example, when the code is in a shared
@@ -334,7 +334,7 @@ QPixmap QPixmap::copy(const QRect &rect) const
region is left unchanged. You can optionally pass a pointer to an empty
QRegion to get the region that is \a exposed by the scroll operation.
- \snippet doc/src/snippets/code/src_gui_image_qpixmap.cpp 2
+ \snippet code/src_gui_image_qpixmap.cpp 2
You cannot scroll while there is an active painter on the pixmap.
@@ -651,7 +651,7 @@ void QPixmap::setMask(const QBitmap &mask)
The mask may not be perfect but it should be reasonable, so you
can do things such as the following:
- \snippet doc/src/snippets/code/src_gui_image_qpixmap.cpp 1
+ \snippet code/src_gui_image_qpixmap.cpp 1
This function is slow because it involves converting to/from a
QImage, and non-trivial computations.
@@ -810,7 +810,7 @@ bool QPixmap::save(const QString &fileName, const char *format, int quality) con
specified image file \a format and \a quality factor. This can be
used, for example, to save a pixmap directly into a QByteArray:
- \snippet doc/src/snippets/image/image.cpp 1
+ \snippet image/image.cpp 1
*/
bool QPixmap::save(QIODevice* device, const char* format, int quality) const
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 7769c45b2e..b0e5b7e1e3 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -472,7 +472,7 @@ QPixmapCacheEntry::~QPixmapCacheEntry()
bool find(const QString&, QPixmap*) instead.
Example:
- \snippet doc/src/snippets/code/src_gui_image_qpixmapcache.cpp 0
+ \snippet code/src_gui_image_qpixmapcache.cpp 0
*/
QPixmap *QPixmapCache::find(const QString &key)
@@ -500,7 +500,7 @@ bool QPixmapCache::find(const QString &key, QPixmap& pixmap)
\since 4.6
Example:
- \snippet doc/src/snippets/code/src_gui_image_qpixmapcache.cpp 1
+ \snippet code/src_gui_image_qpixmapcache.cpp 1
*/
bool QPixmapCache::find(const QString &key, QPixmap* pixmap)
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index ef5e4f9c18..90fd63ee62 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE
as QApplication::clipboard().
Example:
- \snippet doc/src/snippets/code/src_gui_kernel_qclipboard.cpp 0
+ \snippet code/src_gui_kernel_qclipboard.cpp 0
QClipboard features some convenience functions to access common
data types: setText() allows the exchange of Unicode text and
@@ -80,7 +80,7 @@ QT_BEGIN_NAMESPACE
A typical example of the use of these functions follows:
- \snippet doc/src/snippets/droparea.cpp 0
+ \snippet droparea.cpp 0
\section1 Notes for X11 Users
@@ -366,7 +366,7 @@ QImage QClipboard::image(Mode mode) const
This is shorthand for:
- \snippet doc/src/snippets/code/src_gui_kernel_qclipboard.cpp 1
+ \snippet code/src_gui_kernel_qclipboard.cpp 1
\sa image(), setPixmap() setMimeData()
*/
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index 40015c8706..e20401c67b 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
QMimeData object. This is specified with the setMimeData() function in the
following way:
- \snippet doc/src/snippets/dragging/mainwindow.cpp 1
+ \snippet dragging/mainwindow.cpp 1
Note that setMimeData() assigns ownership of the QMimeData object to the
QDrag object. The QDrag must be constructed on the heap with a parent QObject
@@ -80,7 +80,7 @@ QT_BEGIN_NAMESPACE
that the cursor's hot spot points to the center of its bottom
edge:
- \snippet doc/src/snippets/separations/finalwidget.cpp 2
+ \snippet separations/finalwidget.cpp 2
\note On X11, the pixmap may not be able to keep up with the mouse
movements if the hot spot causes the pixmap to be displayed
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 266eb143e5..eeedd32fd9 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -582,7 +582,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
Example:
- \snippet doc/src/snippets/code/src_gui_kernel_qevent.cpp 0
+ \snippet code/src_gui_kernel_qevent.cpp 0
*/
/*!
@@ -604,7 +604,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
Example:
- \snippet doc/src/snippets/code/src_gui_kernel_qevent.cpp 0
+ \snippet code/src_gui_kernel_qevent.cpp 0
*/
/*!
@@ -2557,9 +2557,9 @@ QHelpEvent::~QHelpEvent()
\table 100%
\row
\li
- \snippet doc/src/snippets/qstatustipevent/main.cpp 1
+ \snippet qstatustipevent/main.cpp 1
\dots
- \snippet doc/src/snippets/qstatustipevent/main.cpp 3
+ \snippet qstatustipevent/main.cpp 3
\li
\image qstatustipevent-widget.png Widget with status tip.
\endtable
@@ -2570,10 +2570,10 @@ QHelpEvent::~QHelpEvent()
\table 100%
\row
\li
- \snippet doc/src/snippets/qstatustipevent/main.cpp 0
- \snippet doc/src/snippets/qstatustipevent/main.cpp 2
+ \snippet qstatustipevent/main.cpp 0
+ \snippet qstatustipevent/main.cpp 2
\dots
- \snippet doc/src/snippets/qstatustipevent/main.cpp 3
+ \snippet qstatustipevent/main.cpp 3
\li
\image qstatustipevent-action.png Action with status tip.
\endtable
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 27e84b71a9..b63ed78c4b 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2078,7 +2078,7 @@ static inline void applyCursor(const QList<QWindow *> &l, const QCursor &c)
restoreOverrideCursor(), otherwise the stack will never be emptied.
Example:
- \snippet doc/src/snippets/code/src_gui_kernel_qapplication_x11.cpp 0
+ \snippet code/src_gui_kernel_qapplication_x11.cpp 0
\sa overrideCursor(), restoreOverrideCursor(), changeOverrideCursor(),
QWidget::setCursor()
@@ -2134,7 +2134,7 @@ QStyleHints *QGuiApplication::styleHints()
This function must be called before creating the QGuiApplication object, like
this:
- \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 6
+ \snippet code/src_gui_kernel_qapplication.cpp 6
\sa desktopSettingsAware()
*/
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 4946a1dc18..635e3dadca 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -181,7 +181,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
printing a document, and can be specified in any of the following
ways:
- \snippet doc/src/snippets/code/src_gui_kernel_qkeysequence.cpp 0
+ \snippet code/src_gui_kernel_qkeysequence.cpp 0
Note that, for letters, the case used in the specification string
does not matter. In the above examples, the user does not need to
@@ -354,7 +354,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
For example, the key sequence, \key{Ctrl X} followed by \key{Ctrl C}, can
be specified using either of the following ways:
- \snippet doc/src/snippets/code/src_gui_kernel_qkeysequence.cpp 1
+ \snippet code/src_gui_kernel_qkeysequence.cpp 1
\warning A QApplication instance must have been constructed before a
QKeySequence is created; otherwise, your application may crash.
@@ -929,7 +929,7 @@ QKeySequence::QKeySequence()
\endlink(), so that shortcut keys can be replaced in
translations:
- \snippet doc/src/snippets/code/src_gui_kernel_qkeysequence.cpp 2
+ \snippet code/src_gui_kernel_qkeysequence.cpp 2
Note the "File|Open" translator comment. It is by no means
necessary, but it provides some context for the human translator.
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index ab62ec0992..cb18b0d22f 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -499,7 +499,7 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button)
and the QTextDocument::setDefaultStyleSheet() function to alter
the appearance of links. For example:
- \snippet doc/src/snippets/textdocument-css/main.cpp 0
+ \snippet textdocument-css/main.cpp 0
\value NoRole No role; this special role is often used to indicate that a
role has not been assigned.
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index a750082219..267f528ca0 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -528,7 +528,7 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e)
/*! \internal
Clears \a seq to an empty QKeySequence.
Same as doing (the slower)
- \snippet doc/src/snippets/code/src_gui_kernel_qshortcutmap.cpp 0
+ \snippet code/src_gui_kernel_qshortcutmap.cpp 0
*/
void QShortcutMap::clearSequence(QVector<QKeySequence> &ksl)
{
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index c0899e5a41..e9973be2ab 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE
program is activated in the current QOpenGLContext by calling
QOpenGLShaderProgram::bind():
- \snippet doc/src/snippets/code/src_gui_qopenglshaderprogram.cpp 0
+ \snippet code/src_gui_qopenglshaderprogram.cpp 0
\section1 Writing portable shaders
@@ -99,12 +99,12 @@ QT_BEGIN_NAMESPACE
\section1 Simple shader example
- \snippet doc/src/snippets/code/src_gui_qopenglshaderprogram.cpp 1
+ \snippet code/src_gui_qopenglshaderprogram.cpp 1
With the above shader program active, we can draw a green triangle
as follows:
- \snippet doc/src/snippets/code/src_gui_qopenglshaderprogram.cpp 2
+ \snippet code/src_gui_qopenglshaderprogram.cpp 2
\section1 Binary shaders and programs
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 2f0fb9f96c..6ee28a42b9 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -292,7 +292,7 @@ struct QBrushDataPointerDeleter
gradients: QLinearGradient, QConicalGradient, and QRadialGradient
- all of which inherit QGradient.
- \snippet doc/src/snippets/brush/gradientcreationsnippet.cpp 0
+ \snippet brush/gradientcreationsnippet.cpp 0
The texture() defines the pixmap used when the current style is
Qt::TexturePattern. You can create a brush with a texture by
@@ -323,7 +323,7 @@ struct QBrushDataPointerDeleter
QPainter's \l {QPen}{pen} combined with Qt::PenStyle and
Qt::GlobalColor:
- \snippet doc/src/snippets/code/src_gui_painting_qbrush.cpp 0
+ \snippet code/src_gui_painting_qbrush.cpp 0
Note that, by default, QPainter renders the outline (using the
currently set pen) when drawing shapes. Use \l {Qt::NoPen}{\c
@@ -1214,13 +1214,13 @@ QDataStream &operator>>(QDataStream &s, QBrush &b)
A diagonal linear gradient from black at (100, 100) to white at
(200, 200) could be specified like this:
- \snippet doc/src/snippets/brush/brush.cpp 0
+ \snippet brush/brush.cpp 0
A gradient can have an arbitrary number of stop points. The
following would create a radial gradient starting with
red in the center, blue and then green on the edges:
- \snippet doc/src/snippets/brush/brush.cpp 1
+ \snippet brush/brush.cpp 1
It is possible to repeat or reflect the gradient outside its area
by specifiying the \l {QGradient::Spread}{spread method} using the
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 75122571d6..81f5a7438a 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -148,7 +148,7 @@ QT_BEGIN_NAMESPACE
represents a fully transparent color, while 255 represents a fully
opaque color. For example:
- \snippet doc/src/snippets/code/src_gui_painting_qcolor.cpp 0
+ \snippet code/src_gui_painting_qcolor.cpp 0
The code above produces the following output:
diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp
index c26d7e5d98..afefb1787c 100644
--- a/src/gui/painting/qmatrix.cpp
+++ b/src/gui/painting/qmatrix.cpp
@@ -114,7 +114,7 @@ QT_BEGIN_NAMESPACE
\row
\li \inlineimage qmatrix-simpletransformation.png
\li
- \snippet doc/src/snippets/matrix/matrix.cpp 0
+ \snippet matrix/matrix.cpp 0
\endtable
Although these functions are very convenient, it can be more
@@ -126,7 +126,7 @@ QT_BEGIN_NAMESPACE
\row
\li \inlineimage qmatrix-combinedtransformation.png
\li
- \snippet doc/src/snippets/matrix/matrix.cpp 1
+ \snippet matrix/matrix.cpp 1
\endtable
\section1 Basic Matrix Operations
@@ -142,7 +142,7 @@ QT_BEGIN_NAMESPACE
QMatrix transforms a point in the plane to another point using the
following formulas:
- \snippet doc/src/snippets/code/src_gui_painting_qmatrix.cpp 0
+ \snippet code/src_gui_painting_qmatrix.cpp 0
The point \e (x, y) is the original point, and \e (x', y') is the
transformed point. \e (x', y') can be transformed back to \e (x,
@@ -174,7 +174,7 @@ QT_BEGIN_NAMESPACE
\row
\li \inlineimage qmatrix-combinedtransformation.png
\li
- \snippet doc/src/snippets/matrix/matrix.cpp 2
+ \snippet matrix/matrix.cpp 2
\endtable
\sa QPainter, QTransform, {Coordinate System},
@@ -342,7 +342,7 @@ void QMatrix::setMatrix(qreal m11, qreal m12, qreal m21, qreal m22, qreal dx, qr
The coordinates are transformed using the following formulas:
- \snippet doc/src/snippets/code/src_gui_painting_qmatrix.cpp 1
+ \snippet code/src_gui_painting_qmatrix.cpp 1
The point (x, y) is the original point, and (x', y') is the
transformed point.
@@ -427,7 +427,7 @@ QRect QMatrix::mapRect(const QRect &rect) const
The rectangle's coordinates are transformed using the following
formulas:
- \snippet doc/src/snippets/code/src_gui_painting_qmatrix.cpp 2
+ \snippet code/src_gui_painting_qmatrix.cpp 2
If rotation or shearing has been specified, this function returns
the \e bounding rectangle. To retrieve the exact region the given
@@ -741,7 +741,7 @@ QPainterPath QMatrix::map(const QPainterPath &path) const
The rectangle's coordinates are transformed using the following
formulas:
- \snippet doc/src/snippets/code/src_gui_painting_qmatrix.cpp 3
+ \snippet code/src_gui_painting_qmatrix.cpp 3
Polygons and rectangles behave slightly differently when
transformed (due to integer rounding), so
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 68e60ed548..e622fe46a7 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -941,7 +941,7 @@ void QPainterPrivate::updateState(QPainterState *newState)
painter. Then draw. Remember to destroy the QPainter object after
drawing. For example:
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 0
+ \snippet code/src_gui_painting_qpainter.cpp 0
The core functionality of QPainter is drawing, but the class also
provide several functions that allows you to customize QPainter's
@@ -1446,10 +1446,10 @@ QPainter::QPainter()
automatically calls end().
Here's an example using begin() and end():
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 1
+ \snippet code/src_gui_painting_qpainter.cpp 1
The same example using this constructor:
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 2
+ \snippet code/src_gui_painting_qpainter.cpp 2
Since the constructor cannot provide feedback when the initialization
of the painter failed you should rather use begin() and end() to paint
@@ -1667,7 +1667,7 @@ void QPainter::restore()
The errors that can occur are serious problems, such as these:
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 3
+ \snippet code/src_gui_painting_qpainter.cpp 3
Note that most of the time, you can use one of the constructors
instead of begin(), and that end() is automatically done at
@@ -1956,7 +1956,7 @@ QPaintEngine *QPainter::paintEngine() const
default state by endNativePainting(). Here is an example that shows
intermixing of painter commands and raw OpenGL commands:
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 21
+ \snippet code/src_gui_painting_qpainter.cpp 21
\sa endNativePainting()
*/
@@ -2871,7 +2871,7 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op)
They operate on the painter's worldMatrix() and are implemented like this:
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 4
+ \snippet code/src_gui_painting_qpainter.cpp 4
Note that when using setWorldMatrix() function you should always have
\a combine be true when you are drawing into a QPicture. Otherwise
@@ -3340,7 +3340,7 @@ void QPainter::fillPath(const QPainterPath &path, const QBrush &brush)
\row
\li \inlineimage qpainter-path.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 5
+ \snippet code/src_gui_painting_qpainter.cpp 5
\endtable
\sa {painting/painterpaths}{the Painter Paths
@@ -3385,7 +3385,7 @@ void QPainter::drawPath(const QPainterPath &path)
\row
\li \inlineimage qpainter-line.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 6
+ \snippet code/src_gui_painting_qpainter.cpp 6
\endtable
\sa drawLines(), drawPolyline(), {Coordinate System}
@@ -3432,7 +3432,7 @@ void QPainter::drawPath(const QPainterPath &path)
\row
\li \inlineimage qpainter-rectangle.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 7
+ \snippet code/src_gui_painting_qpainter.cpp 7
\endtable
\sa drawRects(), drawPolygon(), {Coordinate System}
@@ -4101,7 +4101,7 @@ const QFont &QPainter::font() const
\row
\li \inlineimage qpainter-roundrect.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 8
+ \snippet code/src_gui_painting_qpainter.cpp 8
\endtable
\sa drawRect(), QPen
@@ -4201,7 +4201,7 @@ void QPainter::drawRoundRect(const QRectF &r, int xRnd, int yRnd)
\row
\li \inlineimage qpainter-ellipse.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 9
+ \snippet code/src_gui_painting_qpainter.cpp 9
\endtable
\sa drawPie(), {Coordinate System}
@@ -4327,7 +4327,7 @@ void QPainter::drawEllipse(const QRect &r)
\row
\li \inlineimage qpainter-arc.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 10
+ \snippet code/src_gui_painting_qpainter.cpp 10
\endtable
\sa drawPie(), drawChord(), {Coordinate System}
@@ -4391,7 +4391,7 @@ void QPainter::drawArc(const QRectF &r, int a, int alen)
\row
\li \inlineimage qpainter-pie.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 11
+ \snippet code/src_gui_painting_qpainter.cpp 11
\endtable
\sa drawEllipse(), drawChord(), {Coordinate System}
@@ -4460,7 +4460,7 @@ void QPainter::drawPie(const QRectF &r, int a, int alen)
\row
\li \inlineimage qpainter-chord.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 12
+ \snippet code/src_gui_painting_qpainter.cpp 12
\endtable
\sa drawArc(), drawPie(), {Coordinate System}
@@ -4675,7 +4675,7 @@ void QPainter::drawLines(const QPoint *pointPairs, int lineCount)
\table 100%
\row
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 13
+ \snippet code/src_gui_painting_qpainter.cpp 13
\endtable
\sa drawLines(), drawPolygon(), {Coordinate System}
@@ -4782,7 +4782,7 @@ void QPainter::drawPolyline(const QPoint *points, int pointCount)
\row
\li \inlineimage qpainter-polygon.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 14
+ \snippet code/src_gui_painting_qpainter.cpp 14
\endtable
The first point is implicitly connected to the last point, and the
@@ -4895,7 +4895,7 @@ void QPainter::drawPolygon(const QPoint *points, int pointCount, Qt::FillRule fi
\row
\li \inlineimage qpainter-polygon.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 15
+ \snippet code/src_gui_painting_qpainter.cpp 15
\endtable
The first point is implicitly connected to the last point, and the
@@ -5018,7 +5018,7 @@ static inline QPointF roundInDeviceCoordinates(const QPointF &p, const QTransfor
\table 100%
\row
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 16
+ \snippet code/src_gui_painting_qpainter.cpp 16
\endtable
If \a pixmap is a QBitmap it is drawn with the bits that are "set"
@@ -5928,7 +5928,7 @@ void QPainter::drawText(const QRect &r, int flags, const QString &str, QRect *br
\row
\li \inlineimage qpainter-text.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 17
+ \snippet code/src_gui_painting_qpainter.cpp 17
\endtable
The \a boundingRect (if not null) is set to the what the bounding rectangle
@@ -6682,7 +6682,7 @@ void QPainter::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPo
\table 100%
\row
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 18
+ \snippet code/src_gui_painting_qpainter.cpp 18
\endtable
\sa QPicture::play()
@@ -6725,7 +6725,7 @@ void QPainter::drawPicture(const QPointF &p, const QPicture &picture)
Erases the area inside the given \a rectangle. Equivalent to
calling
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 19
+ \snippet code/src_gui_painting_qpainter.cpp 19
\sa fillRect()
*/
@@ -7669,7 +7669,7 @@ void QPainterState::init(QPainter *p) {
\table 100%
\row
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 20
+ \snippet code/src_gui_painting_qpainter.cpp 20
\endtable
\sa drawPixmap()
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 0e8811b934..dc310520e0 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -229,7 +229,7 @@ static void qt_debug_path(const QPainterPath &path)
\row
\li \inlineimage qpainterpath-construction.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainterpath.cpp 0
+ \snippet code/src_gui_painting_qpainterpath.cpp 0
\endtable
The painter path is initially empty when constructed. We first add
@@ -763,7 +763,7 @@ void QPainterPath::lineTo(const QPointF &p)
\row
\li \inlineimage qpainterpath-cubicto.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainterpath.cpp 1
+ \snippet code/src_gui_painting_qpainterpath.cpp 1
\endtable
\sa quadTo(), {QPainterPath#Composing a QPainterPath}{Composing
@@ -890,7 +890,7 @@ void QPainterPath::quadTo(const QPointF &c, const QPointF &e)
\row
\li \inlineimage qpainterpath-arcto.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainterpath.cpp 2
+ \snippet code/src_gui_painting_qpainterpath.cpp 2
\endtable
\sa arcMoveTo(), addEllipse(), QPainter::drawArc(), QPainter::drawPie(),
@@ -1002,7 +1002,7 @@ QPointF QPainterPath::currentPosition() const
\row
\li \inlineimage qpainterpath-addrectangle.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainterpath.cpp 3
+ \snippet code/src_gui_painting_qpainterpath.cpp 3
\endtable
\sa addRegion(), lineTo(), {QPainterPath#Composing a
@@ -1049,7 +1049,7 @@ void QPainterPath::addRect(const QRectF &r)
\row
\li \inlineimage qpainterpath-addpolygon.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainterpath.cpp 4
+ \snippet code/src_gui_painting_qpainterpath.cpp 4
\endtable
\sa lineTo(), {QPainterPath#Composing a QPainterPath}{Composing
@@ -1085,7 +1085,7 @@ void QPainterPath::addPolygon(const QPolygonF &polygon)
\row
\li \inlineimage qpainterpath-addellipse.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainterpath.cpp 5
+ \snippet code/src_gui_painting_qpainterpath.cpp 5
\endtable
\sa arcTo(), QPainter::drawEllipse(), {QPainterPath#Composing a
@@ -1137,7 +1137,7 @@ void QPainterPath::addEllipse(const QRectF &boundingRect)
\row
\li \inlineimage qpainterpath-addtext.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpainterpath.cpp 6
+ \snippet code/src_gui_painting_qpainterpath.cpp 6
\endtable
\sa QPainter::drawText(), {QPainterPath#Composing a
diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp
index 77f0edc52f..2c95a9f146 100644
--- a/src/gui/painting/qpen.cpp
+++ b/src/gui/painting/qpen.cpp
@@ -79,11 +79,11 @@ typedef QPenPrivate QPenData;
For example:
- \snippet doc/src/snippets/code/src_gui_painting_qpen.cpp 0
+ \snippet code/src_gui_painting_qpen.cpp 0
which is equivalent to
- \snippet doc/src/snippets/code/src_gui_painting_qpen.cpp 1
+ \snippet code/src_gui_painting_qpen.cpp 1
The default pen is a solid black brush with 0 width, square
cap style (Qt::SquareCap), and bevel join style (Qt::BevelJoin).
@@ -135,7 +135,7 @@ typedef QPenPrivate QPenData;
spaces. For example, the custom pattern shown above is created
using the following code:
- \snippet doc/src/snippets/code/src_gui_painting_qpen.cpp 2
+ \snippet code/src_gui_painting_qpen.cpp 2
Note that the dash pattern is specified in units of the pens
width, e.g. a dash of length 5 in width 10 is 50 pixels long.
@@ -476,7 +476,7 @@ QVector<qreal> QPen::dashPattern() const
\row
\li \inlineimage qpen-custom.png
\li
- \snippet doc/src/snippets/code/src_gui_painting_qpen.cpp 3
+ \snippet code/src_gui_painting_qpen.cpp 3
\endtable
The dash pattern is specified in units of the pens width; e.g. a
diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp
index ee1f7967cb..b7dee7ff2a 100644
--- a/src/gui/painting/qpolygon.cpp
+++ b/src/gui/painting/qpolygon.cpp
@@ -98,7 +98,7 @@ static void qt_polygon_isect_line(const QPointF &p1, const QPointF &p2, const QP
points to a QPolygon is to use QVector's streaming operator, as
illustrated below:
- \snippet doc/src/snippets/polygon/polygon.cpp 0
+ \snippet polygon/polygon.cpp 0
In addition to the functions provided by QVector, QPolygon
provides some point-specific functions.
@@ -304,7 +304,7 @@ void QPolygon::point(int index, int *x, int *y) const
The example code creates a polygon with two points (10, 20) and
(30, 40):
- \snippet doc/src/snippets/polygon/polygon.cpp 2
+ \snippet polygon/polygon.cpp 2
\sa setPoint() putPoints()
*/
@@ -330,7 +330,7 @@ void QPolygon::setPoints(int nPoints, const int *points)
The example code creates a polygon with two points (10, 20) and
(30, 40):
- \snippet doc/src/snippets/polygon/polygon.cpp 3
+ \snippet polygon/polygon.cpp 3
*/
void QPolygon::setPoints(int nPoints, int firstx, int firsty, ...)
@@ -381,12 +381,12 @@ void QPolygon::putPoints(int index, int nPoints, const int *points)
The example code creates a polygon with three points (4,5), (6,7)
and (8,9), by expanding the polygon from 1 to 3 points:
- \snippet doc/src/snippets/polygon/polygon.cpp 4
+ \snippet polygon/polygon.cpp 4
The following code has the same result, but here the putPoints()
function overwrites rather than extends:
- \snippet doc/src/snippets/polygon/polygon.cpp 5
+ \snippet polygon/polygon.cpp 5
\sa setPoints()
*/
@@ -418,7 +418,7 @@ void QPolygon::putPoints(int index, int nPoints, int firstx, int firsty, ...)
default) in \a fromPolygon into this polygon, starting at the
specified \a index. For example:
- \snippet doc/src/snippets/polygon/polygon.cpp 6
+ \snippet polygon/polygon.cpp 6
*/
void QPolygon::putPoints(int index, int nPoints, const QPolygon & from, int fromIndex)
@@ -490,7 +490,7 @@ QDebug operator<<(QDebug dbg, const QPolygon &a)
to a QPolygonF is to use its streaming operator, as illustrated
below:
- \snippet doc/src/snippets/polygon/polygon.cpp 1
+ \snippet polygon/polygon.cpp 1
In addition to the functions provided by QVector, QPolygonF
provides the boundingRect() and translate() functions for geometry
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index ebca1edddc..f250150b06 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -86,7 +86,7 @@ QT_BEGIN_NAMESPACE
rectangles.
Example of using complex regions:
- \snippet doc/src/snippets/code/src_gui_painting_qregion.cpp 0
+ \snippet code/src_gui_painting_qregion.cpp 0
\section1 Additional License Information
@@ -725,7 +725,7 @@ QRegion QRegion::intersect(const QRect &r) const
empty region is a region that contains no points.
Example:
- \snippet doc/src/snippets/code/src_gui_painting_qregion_unix.cpp 0
+ \snippet code/src_gui_painting_qregion_unix.cpp 0
*/
/*!
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index ba971d454d..924a444805 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -159,7 +159,7 @@ QT_BEGIN_NAMESPACE
\row
\li \inlineimage qtransform-simpletransformation.png
\li
- \snippet doc/src/snippets/transform/main.cpp 0
+ \snippet transform/main.cpp 0
\endtable
Although these functions are very convenient, it can be more
@@ -171,7 +171,7 @@ QT_BEGIN_NAMESPACE
\row
\li \inlineimage qtransform-combinedtransformation.png
\li
- \snippet doc/src/snippets/transform/main.cpp 1
+ \snippet transform/main.cpp 1
\endtable
\section1 Basic Matrix Operations
@@ -188,7 +188,7 @@ QT_BEGIN_NAMESPACE
QTransform transforms a point in the plane to another point using the
following formulas:
- \snippet doc/src/snippets/code/src_gui_painting_qtransform.cpp 0
+ \snippet code/src_gui_painting_qtransform.cpp 0
The point \e (x, y) is the original point, and \e (x', y') is the
transformed point. \e (x', y') can be transformed back to \e (x,
@@ -221,7 +221,7 @@ QT_BEGIN_NAMESPACE
\row
\li \inlineimage qtransform-combinedtransformation2.png
\li
- \snippet doc/src/snippets/transform/main.cpp 2
+ \snippet transform/main.cpp 2
\endtable
\sa QPainter, {Coordinate System}, {painting/affine}{Affine
@@ -1662,7 +1662,7 @@ QPainterPath QTransform::map(const QPainterPath &path) const
The rectangle's coordinates are transformed using the following
formulas:
- \snippet doc/src/snippets/code/src_gui_painting_qtransform.cpp 1
+ \snippet code/src_gui_painting_qtransform.cpp 1
Polygons and rectangles behave slightly differently when
transformed (due to integer rounding), so
@@ -1915,7 +1915,7 @@ QRect QTransform::mapRect(const QRect &rect) const
The rectangle's coordinates are transformed using the following
formulas:
- \snippet doc/src/snippets/code/src_gui_painting_qtransform.cpp 2
+ \snippet code/src_gui_painting_qtransform.cpp 2
If rotation or shearing has been specified, this function returns
the \e bounding rectangle. To retrieve the exact region the given
@@ -1991,7 +1991,7 @@ QRectF QTransform::mapRect(const QRectF &rect) const
The coordinates are transformed using the following formulas:
- \snippet doc/src/snippets/code/src_gui_painting_qtransform.cpp 3
+ \snippet code/src_gui_painting_qtransform.cpp 3
The point (x, y) is the original point, and (x', y') is the
transformed point.
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 161bb4e23d..cd1556070e 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -367,7 +367,7 @@ QFontEngineData::~QFontEngineData()
Create QFonts like this:
- \snippet doc/src/snippets/code/src_gui_text_qfont.cpp 0
+ \snippet code/src_gui_text_qfont.cpp 0
The attributes set in the constructor can also be set later, e.g.
setFamily(), setPointSize(), setPointSizeFloat(), setWeight() and
@@ -464,11 +464,11 @@ QFontEngineData::~QFontEngineData()
Examples:
- \snippet doc/src/snippets/code/src_gui_text_qfont.cpp 1
+ \snippet code/src_gui_text_qfont.cpp 1
If you had both an Adobe and a Cronyx Helvetica, you might get
either.
- \snippet doc/src/snippets/code/src_gui_text_qfont.cpp 2
+ \snippet code/src_gui_text_qfont.cpp 2
You can specify the foundry you want in the family name. The font f
in the above example will be set to "Helvetica
@@ -477,11 +477,11 @@ QFontEngineData::~QFontEngineData()
To determine the attributes of the font actually used in the window
system, use a QFontInfo object, e.g.
- \snippet doc/src/snippets/code/src_gui_text_qfont.cpp 3
+ \snippet code/src_gui_text_qfont.cpp 3
To find out font metrics use a QFontMetrics object, e.g.
- \snippet doc/src/snippets/code/src_gui_text_qfont.cpp 4
+ \snippet code/src_gui_text_qfont.cpp 4
For more general information on fonts, see the
\link http://nwalsh.com/comp.fonts/FAQ/ comp.fonts FAQ.\endlink
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index a1af856992..42096d9ae7 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -1197,8 +1197,8 @@ QString QFontDatabase::styleString(const QFontInfo &fontInfo)
Example:
- \snippet doc/src/snippets/qfontdatabase/main.cpp 0
- \snippet doc/src/snippets/qfontdatabase/main.cpp 1
+ \snippet qfontdatabase/main.cpp 0
+ \snippet qfontdatabase/main.cpp 1
This example gets the list of font families, the list of
styles for each family, and the point sizes that are available for
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index fe9e1d16c7..cc6fa4bfee 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -122,7 +122,7 @@ extern void qt_format_text(const QFont& font, const QRectF &_r,
and size(), to return the size of that rectangle.
Example:
- \snippet doc/src/snippets/code/src_gui_text_qfontmetrics.cpp 0
+ \snippet code/src_gui_text_qfontmetrics.cpp 0
\sa QFont, QFontInfo, QFontDatabase, QFontComboBox, {Character Map Example}
*/
@@ -976,7 +976,7 @@ int QFontMetrics::lineWidth() const
and size(), to return the size of that rectangle.
Example:
- \snippet doc/src/snippets/code/src_gui_text_qfontmetrics.cpp 1
+ \snippet code/src_gui_text_qfontmetrics.cpp 1
\sa QFont QFontInfo QFontDatabase
*/
diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp
index c6810ad61f..c372071019 100644
--- a/src/gui/text/qsyntaxhighlighter.cpp
+++ b/src/gui/text/qsyntaxhighlighter.cpp
@@ -253,7 +253,7 @@ void QSyntaxHighlighterPrivate::reformatBlock(const QTextBlock &block)
pass it the QTextEdit or QTextDocument that you want the syntax
highlighting to be applied to. For example:
- \snippet doc/src/snippets/code/src_gui_text_qsyntaxhighlighter.cpp 0
+ \snippet code/src_gui_text_qsyntaxhighlighter.cpp 0
After this your highlightBlock() function will be called
automatically whenever necessary. Use your highlightBlock()
@@ -262,7 +262,7 @@ void QSyntaxHighlighterPrivate::reformatBlock(const QTextBlock &block)
setFormat() function which applies a given QTextCharFormat on
the current text block. For example:
- \snippet doc/src/snippets/code/src_gui_text_qsyntaxhighlighter.cpp 1
+ \snippet code/src_gui_text_qsyntaxhighlighter.cpp 1
Some syntaxes can have constructs that span several text
blocks. For example, a C++ syntax highlighter should be able to
@@ -285,7 +285,7 @@ void QSyntaxHighlighterPrivate::reformatBlock(const QTextBlock &block)
For example, if you're writing a simple C++ syntax highlighter,
you might designate 1 to signify "in comment":
- \snippet doc/src/snippets/code/src_gui_text_qsyntaxhighlighter.cpp 2
+ \snippet code/src_gui_text_qsyntaxhighlighter.cpp 2
In the example above, we first set the current block state to
0. Then, if the previous block ended within a comment, we higlight
@@ -432,7 +432,7 @@ void QSyntaxHighlighter::rehighlightBlock(const QTextBlock &block)
setFormat() as often as necessary to apply any font and color
changes that you require. For example:
- \snippet doc/src/snippets/code/src_gui_text_qsyntaxhighlighter.cpp 3
+ \snippet code/src_gui_text_qsyntaxhighlighter.cpp 3
Some syntaxes can have constructs that span several text
blocks. For example, a C++ syntax highlighter should be able to
@@ -602,7 +602,7 @@ void QSyntaxHighlighter::setCurrentBlockState(int newState)
and store their relative position and the actual QChar in a simple
class derived from QTextBlockUserData:
- \snippet doc/src/snippets/code/src_gui_text_qsyntaxhighlighter.cpp 4
+ \snippet code/src_gui_text_qsyntaxhighlighter.cpp 4
During cursor navigation in the associated editor, you can ask the
current QTextBlock (retrieved using the QTextCursor::block()
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 02fd921fac..ce46ec2e59 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -972,7 +972,7 @@ QTextLayout *QTextCursorPrivate::blockLayout(QTextBlock &block) const{
diacritics). Functions such as movePosition() and deleteChar()
limit cursor movement to these valid positions.
- \sa \link richtext.html Rich Text Processing\endlink
+ \sa {Rich Text Processing}
*/
@@ -1380,7 +1380,7 @@ void QTextCursor::setKeepPositionOnInsert(bool b)
If there is a selection, the selection is deleted and replaced by
\a text, for example:
- \snippet doc/src/snippets/code/src_gui_text_qtextcursor.cpp 0
+ \snippet code/src_gui_text_qtextcursor.cpp 0
This clears any existing selection, selects the word at the cursor
(i.e. from position() forward), and replaces the selection with
the phrase "Hello World".
@@ -2301,7 +2301,7 @@ void QTextCursor::insertImage(const QTextImageFormat &format)
Convenience method for inserting the image with the given \a name at the
current position().
- \snippet doc/src/snippets/code/src_gui_text_qtextcursor.cpp 1
+ \snippet code/src_gui_text_qtextcursor.cpp 1
*/
void QTextCursor::insertImage(const QString &name)
{
@@ -2445,7 +2445,7 @@ bool QTextCursor::operator>(const QTextCursor &rhs) const
For example:
- \snippet doc/src/snippets/code/src_gui_text_qtextcursor.cpp 2
+ \snippet code/src_gui_text_qtextcursor.cpp 2
The call to undo() will cause both insertions to be undone,
causing both "World" and "Hello" to be removed.
@@ -2474,7 +2474,7 @@ void QTextCursor::beginEditBlock()
For example:
- \snippet doc/src/snippets/code/src_gui_text_qtextcursor.cpp 3
+ \snippet code/src_gui_text_qtextcursor.cpp 3
The call to undo() will cause all three insertions to be undone.
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index ec660dd050..f0546566d4 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1511,7 +1511,7 @@ QTextBlock QTextDocument::begin() const
This function returns a block to test for the end of the document
while iterating over it.
- \snippet doc/src/snippets/textdocumentendsnippet.cpp 0
+ \snippet textdocumentendsnippet.cpp 0
The block returned is invalid and represents the block after the
last block in the document. You can use lastBlock() to retrieve the
@@ -1868,15 +1868,15 @@ QVariant QTextDocument::resource(int type, const QUrl &name) const
For example, you can add an image as a resource in order to reference it
from within the document:
- \snippet snippets/textdocument-resources/main.cpp Adding a resource
+ \snippet textdocument-resources/main.cpp Adding a resource
The image can be inserted into the document using the QTextCursor API:
- \snippet snippets/textdocument-resources/main.cpp Inserting an image with a cursor
+ \snippet textdocument-resources/main.cpp Inserting an image with a cursor
Alternatively, you can insert images using the HTML \c img tag:
- \snippet snippets/textdocument-resources/main.cpp Inserting an image using HTML
+ \snippet textdocument-resources/main.cpp Inserting an image using HTML
*/
void QTextDocument::addResource(int type, const QUrl &name, const QVariant &resource)
{
@@ -2967,7 +2967,7 @@ void QTextHtmlExporter::emitFrameStyle(const QTextFrameFormat &format, FrameType
The \a encoding parameter specifies the value for the charset attribute
in the html header. For example if 'utf-8' is specified then the
beginning of the generated html will look like this:
- \snippet doc/src/snippets/code/src_gui_text_qtextdocument.cpp 0
+ \snippet code/src_gui_text_qtextdocument.cpp 0
If no encoding is specified then no such meta information is generated.
diff --git a/src/gui/text/qtextdocumentwriter.cpp b/src/gui/text/qtextdocumentwriter.cpp
index b0bbeb7a47..2894c280e8 100644
--- a/src/gui/text/qtextdocumentwriter.cpp
+++ b/src/gui/text/qtextdocumentwriter.cpp
@@ -160,7 +160,7 @@ QTextDocumentWriter::~QTextDocumentWriter()
Sets the format used to write documents to the \a format specified.
\a format is a case insensitive text string. For example:
- \snippet doc/src/snippets/code/src.gui.text.qtextdocumentwriter.cpp 0
+ \snippet code/src_gui_text_qtextdocumentwriter.cpp 0
You can call supportedDocumentFormats() for the full list of formats
QTextDocumentWriter supports.
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 9a38b1f0b2..bb3d897ebe 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -2269,7 +2269,7 @@ QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const
can be used to customize the numbers used in an ordered list so that they
appear as (1), (2), (3), etc.:
- \snippet doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp add a styled, ordered list
+ \snippet textdocument-listitemstyles/mainwindow.cpp add a styled, ordered list
\sa QTextList
*/
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 94af3edeeb..0ab964778a 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -282,10 +282,10 @@ Qt::LayoutDirection QTextInlineObject::textDirection() const
created lines.
Here is a code snippet that demonstrates the layout phase:
- \snippet doc/src/snippets/code/src_gui_text_qtextlayout.cpp 0
+ \snippet code/src_gui_text_qtextlayout.cpp 0
The text can then be rendered by calling the layout's draw() function:
- \snippet doc/src/snippets/code/src_gui_text_qtextlayout.cpp 1
+ \snippet code/src_gui_text_qtextlayout.cpp 1
For a given position in the text you can find a valid cursor position with
isValidCursorPosition(), nextCursorPosition(), and previousCursorPosition().
diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp
index c3c71bc021..82d744d654 100644
--- a/src/gui/text/qtextlist.cpp
+++ b/src/gui/text/qtextlist.cpp
@@ -75,7 +75,7 @@ public:
The \l{QTextCursor::insertList()} function inserts an empty block into the
document at the cursor position, and makes it the first item in a list.
- \snippet doc/src/snippets/textdocument-lists/mainwindow.cpp 0
+ \snippet textdocument-lists/mainwindow.cpp 0
The \l{QTextCursor::createList()} function takes the contents of the
cursor's current block and turns it into the first item of a new list.
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp
index a9daf6ba56..d4e9c7d12c 100644
--- a/src/gui/text/qtextobject.cpp
+++ b/src/gui/text/qtextobject.cpp
@@ -939,8 +939,8 @@ bool QTextBlock::isValid() const
An iterator can be constructed and used to access the fragments within
a text block in the following way:
- \snippet doc/src/snippets/textblock-fragments/xmlwriter.cpp 4
- \snippet doc/src/snippets/textblock-fragments/xmlwriter.cpp 7
+ \snippet textblock-fragments/xmlwriter.cpp 4
+ \snippet textblock-fragments/xmlwriter.cpp 7
\sa QTextFragment
*/
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index 65bc8fde1e..a9866187d3 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -510,9 +510,9 @@ void QTextTablePrivate::update() const
For example, we can insert a table with three rows and two columns at the
current cursor position in an editor using the following lines of code:
- \snippet doc/src/snippets/textdocument-tables/mainwindow.cpp 1
+ \snippet textdocument-tables/mainwindow.cpp 1
\codeline
- \snippet doc/src/snippets/textdocument-tables/mainwindow.cpp 3
+ \snippet textdocument-tables/mainwindow.cpp 3
The table format is either defined when the table is created or changed
later with setFormat().
@@ -545,14 +545,14 @@ void QTextTablePrivate::update() const
\li Suppose we have a 2x3 table of names and addresses. To merge both
columns in the first row we invoke mergeCells() with \a row = 0,
\a column = 0, \a numRows = 1 and \a numColumns = 2.
- \snippet doc/src/snippets/textdocument-texttable/main.cpp 0
+ \snippet textdocument-texttable/main.cpp 0
\row
\li \inlineimage texttable-merge.png
\li This gives us the following table. To split the first row of the table
back into two cells, we invoke the splitCell() function with \a numRows
and \a numCols = 1.
- \snippet doc/src/snippets/textdocument-texttable/main.cpp 1
+ \snippet textdocument-texttable/main.cpp 1
\row
\li \inlineimage texttable-split.png Split Table
diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp
index a941c06031..1535162735 100644
--- a/src/gui/util/qdesktopservices.cpp
+++ b/src/gui/util/qdesktopservices.cpp
@@ -135,7 +135,7 @@ void QOpenUrlHandlerRegistry::handlerDestroyed(QObject *handler)
URLs, and by registering a handler it becomes possible to display the help text
inside the application:
- \snippet doc/src/snippets/code/src_gui_util_qdesktopservices.cpp 0
+ \snippet code/src_gui_util_qdesktopservices.cpp 0
If inside the handler you decide that you can't open the requested
URL, you can just call QDesktopServices::openUrl() again with the
@@ -155,7 +155,7 @@ void QOpenUrlHandlerRegistry::handlerDestroyed(QObject *handler)
The following example opens a file on the Windows file system residing on a path
that contains spaces:
- \snippet doc/src/snippets/code/src_gui_util_qdesktopservices.cpp 2
+ \snippet code/src_gui_util_qdesktopservices.cpp 2
If a \c mailto URL is specified, the user's e-mail client will be used to open a
composer window containing the options specified in the URL, similar to the way
@@ -164,7 +164,7 @@ void QOpenUrlHandlerRegistry::handlerDestroyed(QObject *handler)
For example, the following URL contains a recipient (\c{user@foo.com}), a
subject (\c{Test}), and a message body (\c{Just a test}):
- \snippet doc/src/snippets/code/src_gui_util_qdesktopservices.cpp 1
+ \snippet code/src_gui_util_qdesktopservices.cpp 1
\warning Although many e-mail clients can send attachments and are
Unicode-aware, the user may have configured their client without these features.
diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp
index 3103cc7424..84a5b4c54c 100644
--- a/src/gui/util/qvalidator.cpp
+++ b/src/gui/util/qvalidator.cpp
@@ -303,12 +303,12 @@ void QValidator::fixup(QString &) const
Example of use:
- \snippet doc/src/snippets/code/src_gui_widgets_qvalidator.cpp 0
+ \snippet code/src_gui_util_qvalidator.cpp 0
Below we present some examples of validators. In practice they would
normally be associated with a widget as in the example above.
- \snippet doc/src/snippets/code/src_gui_widgets_qvalidator.cpp 1
+ \snippet code/src_gui_util_qvalidator.cpp 1
Notice that the value \c 999 returns Intermediate. Values
consisting of a number of digits equal to or less than the max
@@ -377,7 +377,7 @@ QIntValidator::~QIntValidator()
the user might be just about to type the minus (especially for right-to-left
languages).
- \snippet doc/src/snippets/code/src_gui_widgets_qvalidator.cpp 2
+ \snippet code/src_gui_util_qvalidator.cpp 2
By default, the \a pos parameter is not used by this validator.
*/
@@ -812,12 +812,12 @@ QDoubleValidator::Notation QDoubleValidator::notation() const
For a brief introduction to Qt's regexp engine, see \l QRegExp.
Example of use:
- \snippet doc/src/snippets/code/src_gui_widgets_qvalidator.cpp 3
+ \snippet code/src_gui_util_qvalidator.cpp 3
Below we present some examples of validators. In practice they would
normally be associated with a widget as in the example above.
- \snippet doc/src/snippets/code/src_gui_widgets_qvalidator.cpp 4
+ \snippet code/src_gui_util_qvalidator.cpp 4
\sa QRegExp, QIntValidator, QDoubleValidator, {Settings Editor Example}
*/