summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure4
-rw-r--r--doc/global/compat.qdocconf11
-rw-r--r--doc/global/externalsites/external-resources.qdoc479
-rw-r--r--doc/global/externalsites/qch-urls.qdoc95
-rw-r--r--doc/global/externalsites/qt-webpages.qdoc92
-rw-r--r--doc/global/externalsites/rfc.qdoc79
-rw-r--r--doc/global/macros.qdocconf37
-rw-r--r--doc/global/qt-cpp-ignore.qdocconf116
-rw-r--r--doc/global/qt-defines.qdocconf17
-rw-r--r--doc/global/qt-html-templates-offline.qdocconf10
-rw-r--r--doc/global/qt-html-templates-online.qdocconf95
-rw-r--r--doc/global/qt-module-defaults-online.qdocconf32
-rw-r--r--doc/global/qt-module-defaults.qdocconf89
-rwxr-xr-xdoc/global/template/images/arrow.pngbin0 -> 1071 bytes
-rw-r--r--doc/global/template/images/arrow_down.pngbin0 -> 177 bytes
-rwxr-xr-xdoc/global/template/images/bg_l.pngbin0 -> 100 bytes
-rwxr-xr-xdoc/global/template/images/bg_l_blank.pngbin0 -> 84 bytes
-rw-r--r--doc/global/template/images/bg_ll_blank.pngbin0 -> 320 bytes
-rwxr-xr-xdoc/global/template/images/bg_r.pngbin0 -> 96 bytes
-rw-r--r--doc/global/template/images/bg_ul_blank.pngbin0 -> 304 bytes
-rwxr-xr-xdoc/global/template/images/bgrContent.pngbin0 -> 149 bytes
-rwxr-xr-xdoc/global/template/images/blu_dot.pngbin0 -> 168 bytes
-rwxr-xr-xdoc/global/template/images/box_bg.pngbin0 -> 89 bytes
-rwxr-xr-xdoc/global/template/images/breadcrumb.pngbin0 -> 134 bytes
-rwxr-xr-xdoc/global/template/images/btn_next.pngbin0 -> 689 bytes
-rw-r--r--doc/global/template/images/btn_next_green.pngbin0 -> 695 bytes
-rwxr-xr-xdoc/global/template/images/btn_prev.pngbin0 -> 676 bytes
-rw-r--r--doc/global/template/images/btn_prev_green.pngbin0 -> 687 bytes
-rw-r--r--doc/global/template/images/bullet_dn.pngbin0 -> 230 bytes
-rwxr-xr-xdoc/global/template/images/bullet_gt.pngbin0 -> 124 bytes
-rwxr-xr-xdoc/global/template/images/bullet_sq.pngbin0 -> 74 bytes
-rw-r--r--doc/global/template/images/bullet_up.pngbin0 -> 210 bytes
-rwxr-xr-xdoc/global/template/images/feedbackground.pngbin0 -> 263 bytes
-rw-r--r--doc/global/template/images/header_bg.pngbin0 -> 114 bytes
-rwxr-xr-xdoc/global/template/images/home.pngbin0 -> 1076 bytes
-rwxr-xr-xdoc/global/template/images/horBar.pngbin0 -> 2807 bytes
-rwxr-xr-xdoc/global/template/images/ico_note.pngbin0 -> 649 bytes
-rwxr-xr-xdoc/global/template/images/ico_note_attention.pngbin0 -> 529 bytes
-rwxr-xr-xdoc/global/template/images/ico_out.pngbin0 -> 362 bytes
-rw-r--r--doc/global/template/images/page.pngbin0 -> 3102 bytes
-rwxr-xr-xdoc/global/template/images/page_bg.pngbin0 -> 84 bytes
-rw-r--r--doc/global/template/images/spinner.gifbin0 -> 2037 bytes
-rwxr-xr-xdoc/global/template/images/sprites-combined.pngbin0 -> 62534 bytes
-rw-r--r--doc/global/template/style/offline.css (renamed from doc/global/style/offline.css)84
-rw-r--r--doc/global/template/style/online.css749
-rw-r--r--examples/widgets/doc/src/analogclock.qdoc6
-rw-r--r--examples/widgets/doc/src/calculator.qdoc4
-rw-r--r--examples/widgets/doc/src/calendarwidget.qdoc4
-rw-r--r--examples/widgets/doc/src/charactermap.qdoc4
-rw-r--r--examples/widgets/doc/src/codeeditor.qdoc4
-rw-r--r--examples/widgets/doc/src/digitalclock.qdoc4
-rw-r--r--examples/widgets/doc/src/groupbox.qdoc4
-rw-r--r--examples/widgets/doc/src/icons.qdoc10
-rw-r--r--examples/widgets/doc/src/imageviewer.qdoc6
-rw-r--r--examples/widgets/doc/src/lineedits.qdoc7
-rw-r--r--examples/widgets/doc/src/movie.qdoc6
-rw-r--r--examples/widgets/doc/src/scribble.qdoc4
-rw-r--r--examples/widgets/doc/src/shapedclock.qdoc4
-rw-r--r--examples/widgets/doc/src/sliders.qdoc3
-rw-r--r--examples/widgets/doc/src/spinboxes.qdoc8
-rw-r--r--examples/widgets/doc/src/styles.qdoc4
-rw-r--r--examples/widgets/doc/src/stylesheet.qdoc4
-rw-r--r--examples/widgets/doc/src/tablet.qdoc4
-rw-r--r--examples/widgets/doc/src/tetrix.qdoc4
-rw-r--r--examples/widgets/doc/src/tooltips.qdoc4
-rw-r--r--examples/widgets/doc/src/validators.qdoc34
-rw-r--r--examples/widgets/doc/src/wiggly.qdoc4
-rw-r--r--examples/widgets/doc/src/windowflags.qdoc4
-rw-r--r--mkspecs/features/default_post.prf19
-rw-r--r--mkspecs/features/qt_build_config.prf2
-rw-r--r--src/concurrent/doc/qtconcurrent.qdocconf20
-rw-r--r--src/corelib/doc/qtcore.qdocconf21
-rw-r--r--src/corelib/doc/src/filestorage.qdoc109
-rw-r--r--src/dbus/doc/qtdbus.qdocconf20
-rw-r--r--src/gui/doc/images/plaintext-layout.pngbin0 -> 46384 bytes
-rw-r--r--src/gui/doc/images/richtext-document.pngbin0 -> 8126 bytes
-rw-r--r--src/gui/doc/qtgui.qdocconf30
-rw-r--r--src/gui/doc/snippets/code/doc_src_richtext.cpp85
-rw-r--r--src/gui/doc/snippets/code/doc_src_richtext.qdoc43
-rw-r--r--src/gui/doc/snippets/plaintextlayout/main.cpp52
-rw-r--r--src/gui/doc/snippets/plaintextlayout/plaintextlayout.pro3
-rw-r--r--src/gui/doc/snippets/plaintextlayout/window.cpp108
-rw-r--r--src/gui/doc/snippets/plaintextlayout/window.h61
-rw-r--r--src/gui/doc/snippets/scribe-overview/main.cpp73
-rw-r--r--src/gui/doc/snippets/scribe-overview/scribe-overview.pro1
-rw-r--r--src/gui/doc/snippets/textblock-formats/main.cpp118
-rw-r--r--src/gui/doc/snippets/textblock-formats/textblock-formats.pro2
-rw-r--r--src/gui/doc/snippets/textblock-fragments/main.cpp52
-rw-r--r--src/gui/doc/snippets/textblock-fragments/mainwindow.cpp148
-rw-r--r--src/gui/doc/snippets/textblock-fragments/mainwindow.h65
-rw-r--r--src/gui/doc/snippets/textblock-fragments/textblock-fragments.pro6
-rw-r--r--src/gui/doc/snippets/textblock-fragments/xmlwriter.h64
-rw-r--r--src/gui/doc/snippets/textdocument-blocks/main.cpp52
-rw-r--r--src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp156
-rw-r--r--src/gui/doc/snippets/textdocument-blocks/mainwindow.h65
-rw-r--r--src/gui/doc/snippets/textdocument-blocks/textdocument-blocks.pro6
-rw-r--r--src/gui/doc/snippets/textdocument-blocks/xmlwriter.cpp84
-rw-r--r--src/gui/doc/snippets/textdocument-blocks/xmlwriter.h61
-rw-r--r--src/gui/doc/snippets/textdocument-charformats/main.cpp92
-rw-r--r--src/gui/doc/snippets/textdocument-charformats/textdocument-charformats.pro1
-rw-r--r--src/gui/doc/snippets/textdocument-cursors/main.cpp79
-rw-r--r--src/gui/doc/snippets/textdocument-cursors/textdocument-cursors.pro1
-rw-r--r--src/gui/doc/snippets/textdocument-find/main.cpp91
-rw-r--r--src/gui/doc/snippets/textdocument-find/textdocument-find.pro1
-rw-r--r--src/gui/doc/snippets/textdocument-frames/main.cpp53
-rw-r--r--src/gui/doc/snippets/textdocument-frames/mainwindow.cpp161
-rw-r--r--src/gui/doc/snippets/textdocument-frames/mainwindow.h64
-rw-r--r--src/gui/doc/snippets/textdocument-frames/textdocument-frames.pro6
-rw-r--r--src/gui/doc/snippets/textdocument-frames/xmlwriter.cpp118
-rw-r--r--src/gui/doc/snippets/textdocument-frames/xmlwriter.h64
-rw-r--r--src/gui/doc/snippets/textdocument-imagedrop/main.cpp52
-rw-r--r--src/gui/doc/snippets/textdocument-imagedrop/textdocument-imagedrop.pro2
-rw-r--r--src/gui/doc/snippets/textdocument-imagedrop/textedit.h56
-rw-r--r--src/gui/doc/snippets/textdocument-imageformat/images.qrc6
-rw-r--r--src/gui/doc/snippets/textdocument-imageformat/images/advert.pngbin0 -> 16291 bytes
-rw-r--r--src/gui/doc/snippets/textdocument-imageformat/images/newimage.pngbin0 -> 5490 bytes
-rw-r--r--src/gui/doc/snippets/textdocument-imageformat/main.cpp98
-rw-r--r--src/gui/doc/snippets/textdocument-imageformat/textdocument-imageformat.pro2
-rw-r--r--src/gui/doc/snippets/textdocument-images/images.qrc5
-rw-r--r--src/gui/doc/snippets/textdocument-images/images/advert.pngbin0 -> 16291 bytes
-rw-r--r--src/gui/doc/snippets/textdocument-images/main.cpp72
-rw-r--r--src/gui/doc/snippets/textdocument-images/textdocument-images.pro2
-rw-r--r--src/gui/doc/snippets/textdocument-listitems/main.cpp52
-rw-r--r--src/gui/doc/snippets/textdocument-listitems/mainwindow.cpp197
-rw-r--r--src/gui/doc/snippets/textdocument-listitems/mainwindow.h75
-rw-r--r--src/gui/doc/snippets/textdocument-listitems/textdocument-listitems.pro3
-rw-r--r--src/gui/doc/snippets/textdocument-printing/main.cpp52
-rw-r--r--src/gui/doc/snippets/textdocument-printing/mainwindow.cpp124
-rw-r--r--src/gui/doc/snippets/textdocument-printing/mainwindow.h72
-rw-r--r--src/gui/doc/snippets/textdocument-printing/textdocument-printing.pro3
-rw-r--r--src/gui/doc/snippets/textdocument-selections/main.cpp52
-rw-r--r--src/gui/doc/snippets/textdocument-selections/mainwindow.cpp203
-rw-r--r--src/gui/doc/snippets/textdocument-selections/mainwindow.h79
-rw-r--r--src/gui/doc/snippets/textdocument-selections/textdocument-selections.pro4
-rw-r--r--src/gui/doc/snippets/textdocument-tables/main.cpp52
-rw-r--r--src/gui/doc/snippets/textdocument-tables/mainwindow.h65
-rw-r--r--src/gui/doc/snippets/textdocument-tables/textdocument-tables.pro6
-rw-r--r--src/gui/doc/snippets/textdocument-tables/xmlwriter.cpp155
-rw-r--r--src/gui/doc/snippets/textdocument-tables/xmlwriter.h64
-rw-r--r--src/gui/doc/src/richtext.qdoc1214
-rw-r--r--src/network/doc/qtnetwork.qdocconf22
-rw-r--r--src/opengl/doc/qtopengl.qdocconf22
-rw-r--r--src/printsupport/doc/qtprintsupport.qdocconf22
-rw-r--r--src/sql/doc/qtsql.qdocconf23
-rw-r--r--src/sql/doc/src/sql-programming.qdoc22
-rw-r--r--src/sql/models/qsqlquerymodel.cpp2
-rw-r--r--src/sql/models/qsqlrelationaldelegate.cpp4
-rw-r--r--src/sql/models/qsqlrelationaltablemodel.cpp14
-rw-r--r--src/sql/models/qsqltablemodel.cpp2
-rw-r--r--src/testlib/doc/qttest.qdocconf22
-rw-r--r--src/testlib/doc/src/qttest-index.qdoc62
-rw-r--r--src/testlib/doc/src/qttest.qdoc9
-rw-r--r--src/testlib/doc/src/qttestlib-manual.qdoc233
-rw-r--r--src/testlib/qtestcase.cpp9
-rw-r--r--src/tools/qdoc/codeparser.cpp76
-rw-r--r--src/tools/qdoc/codeparser.h1
-rw-r--r--src/tools/qdoc/config.cpp199
-rw-r--r--src/tools/qdoc/config.h34
-rw-r--r--src/tools/qdoc/cppcodeparser.cpp4
-rw-r--r--src/tools/qdoc/ditaxmlgenerator.cpp5
-rw-r--r--src/tools/qdoc/ditaxmlgenerator.h2
-rw-r--r--src/tools/qdoc/generator.cpp110
-rw-r--r--src/tools/qdoc/generator.h1
-rw-r--r--src/tools/qdoc/helpprojectwriter.cpp1
-rw-r--r--src/tools/qdoc/htmlgenerator.cpp6
-rw-r--r--src/tools/qdoc/location.cpp30
-rw-r--r--src/tools/qdoc/location.h4
-rw-r--r--src/tools/qdoc/main.cpp210
-rw-r--r--src/tools/qdoc/node.cpp2
-rw-r--r--src/tools/qdoc/node.h4
-rw-r--r--src/tools/qdoc/puredocparser.cpp1
-rw-r--r--src/tools/qdoc/qdocdatabase.cpp41
-rw-r--r--src/tools/qdoc/qdocindexfiles.cpp45
-rw-r--r--src/tools/tools.pro6
-rw-r--r--src/widgets/doc/images/widget-examples.pngbin0 -> 6128 bytes
-rw-r--r--src/widgets/doc/qtwidgets.qdocconf22
-rw-r--r--src/widgets/doc/snippets/widgets-tutorial/template.cpp2
-rw-r--r--src/widgets/doc/src/qtwidgets-examples.qdoc48
-rw-r--r--src/widgets/doc/src/qtwidgets-index.qdoc161
-rw-r--r--src/widgets/doc/src/qtwidgets.qdoc2
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/gallery.qdoc2
-rw-r--r--src/xml/doc/qtxml.qdocconf22
182 files changed, 7882 insertions, 780 deletions
diff --git a/configure b/configure
index 5b537f0057..fa8a535a6a 100755
--- a/configure
+++ b/configure
@@ -1901,7 +1901,7 @@ while [ "$#" -gt 0 ]; do
fi
;;
javascript-jit)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then
+ if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then
CFG_JAVASCRIPTCORE_JIT="$VAL"
else
UNKNOWN_OPT=yes
@@ -5209,7 +5209,7 @@ if [ "$CFG_ALSA" = "auto" ]; then
fi
fi
-if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ] || [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then
+if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ] || [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then
if [ "$CFG_ARCH" = "arm" ]; then
compileTest unix/javascriptcore-jit "javascriptcore-jit"
if [ $? != "0" ]; then
diff --git a/doc/global/compat.qdocconf b/doc/global/compat.qdocconf
new file mode 100644
index 0000000000..ec4cfaa7c8
--- /dev/null
+++ b/doc/global/compat.qdocconf
@@ -0,0 +1,11 @@
+alias.include = input
+
+macro.0 = "\\\\0"
+macro.n = "\\\\n"
+macro.r = "\\\\r"
+macro.img = "\\image"
+macro.endquote = "\\endquotation"
+macro.relatesto = "\\relates"
+
+spurious = "Missing comma in .*" \
+ "Missing pattern .*"
diff --git a/doc/global/externalsites/external-resources.qdoc b/doc/global/externalsites/external-resources.qdoc
new file mode 100644
index 0000000000..48b5b44406
--- /dev/null
+++ b/doc/global/externalsites/external-resources.qdoc
@@ -0,0 +1,479 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/*!
+ \externalpage http://www.freedesktop.org/
+ \title freedesktop.org
+*/
+
+/*!
+ \externalpage http://www.freedesktop.org/Standards/xembed-spec
+ \title XEmbed Specification
+*/
+
+/*!
+ \externalpage http://www.freedesktop.org/Standards/icon-theme-spec
+ \title Icon Themes Specification
+*/
+
+/*!
+ \externalpage http://www.cups.org/
+ \title Common Unix Printing System (CUPS)
+ \keyword CUPS
+*/
+
+/*!
+ \externalpage http://www.freedesktop.org/wiki/Standards_2fdesktop_2dentry_2dspec
+ \title Desktop Entry Specification
+*/
+
+/*!
+ \externalpage http://www.kde.org/
+ \title The K Desktop Environment
+ \keyword KDE
+*/
+
+/*!
+ \externalpage http://www.cmake.org/cmake/help/documentation.html
+ \title CMake Documentation
+*/
+
+/*!
+ \externalpage http://www.cmake.org/cmake/help/v2.8.9/cmake.html#command:find_package
+ \title CMake find_package Documentation
+*/
+
+/*!
+ \externalpage http://www.cmake.org/cmake/help/v2.8.9/cmake.html#prop_tgt:AUTOMOC
+ \title CMake AUTOMOC Documentation
+*/
+
+
+/*!
+ \externalpage http://www.cmake.org/cmake/help/v2.8.9/cmake.html#prop_tgt:LOCATION
+ \title CMake LOCATION Documentation
+*/
+
+/*!
+ \externalpage http://www.cmake.org/cmake/help/v2.8.9/cmake.html#prop_tgt:POSITION_INDEPENDENT_CODE
+ \title CMake POSITION_INDEPENDENT_CODE Documentation
+*/
+
+/*!
+ \externalpage http://www.cmake.org/cmake/help/v2.8.9/cmake.html#command:target_link_libraries
+ \title CMake target_link_libraries Documentation
+*/
+
+/*!
+ \externalpage http://www.gnome.org/
+ \title GNOME
+*/
+
+/*!
+ \externalpage http://www.gnu.org/software/emacs/
+ \title GNU Emacs
+*/
+
+/*!
+ \externalpage http://gnuwin32.sourceforge.net/packages.html
+ \title GnuWin32 Project
+*/
+
+/*!
+ \externalpage http://www.w3.org/Graphics/SVG/About.html
+ \title About SVG
+ \keyword Scalable Vector Graphics
+*/
+
+/*!
+ \externalpage http://www.w3.org/TR/SVG/types.html#ColorKeywords
+ \title SVG color keyword names
+*/
+
+/*!
+ \externalpage http://www.w3.org/Graphics/SVG/
+ \title SVG Working Group
+*/
+
+/*!
+ \externalpage http://www.w3.org/TR/SVGMobile/
+ \title Mobile SVG Profiles
+ \omit
+ Mobile SVG Profiles: SVG Tiny and SVG Basic
+ \endomit
+*/
+
+/*!
+ \externalpage http://www.w3.org/TR/SVGMobile12/
+ \title SVG 1.2 Tiny
+*/
+
+/*!
+ \externalpage http://www.w3.org/Graphics/SVG/feature/1.2/#SVG-static
+ \title SVG 1.2 Tiny Static Features
+*/
+
+
+
+/*!
+ \externalpage http://tdm-gcc.tdragon.net/
+ \title TDM-GCC
+*/
+
+/*!
+ \externalpage http://www.dependencywalker.com/
+ \title Dependency Walker
+*/
+
+/*!
+ \externalpage http://webkit.org/
+ \title WebKit Open Source Project
+*/
+
+/*!
+ \externalpage http://www.informit.com/store/product.aspx?isbn=0132354160
+ \title C++ GUI Programming with Qt 4, 2nd Edition
+*/
+
+/*!
+ \externalpage http://www.openssl.org/
+ \title OpenSSL Toolkit
+*/
+
+/*!
+ \externalpage http://arora-browser.org/
+ \title Arora Browser
+*/
+
+/*!
+ \externalpage http://www.activestate.com/Products/activeperl/index.mhtml
+ \title ActivePerl
+*/
+
+/*!
+ \externalpage http://code.google.com/p/angleproject/
+ \title ANGLE
+*/
+
+/*!
+ \externalpage http://msdn.microsoft.com/en-us/directx/default.aspx
+ \title Direct X SDK
+*/
+
+/*!
+ \externalpage http://www.w3.org/TR/html401/
+ \title HTML 4
+*/
+
+/*!
+ \externalpage http://www.w3.org/TR/html5/
+ \title HTML 5
+*/
+
+/*!
+ \externalpage http://site.icu-project.org/
+ \title ICU
+*/
+
+/*!
+ \externalpage http://www.mingw.org/
+ \title MinGW
+*/
+
+/*!
+ \externalpage http://www.python.org/
+ \title Python
+*/
+
+/*!
+ \externalpage http://pyxml.sourceforge.net/topics/xbel/
+ \title XML Bookmark Exchange Language Resource Page
+*/
+
+/*!
+ \externalpage http://www.w3.org/TR/xquery/#errors
+ \title error handling in the XQuery language
+*/
+
+/*!
+ \externalpage http://xaos.sourceforge.net/
+ \title XaoS
+*/
+
+/*!
+ \externalpage http://www.unixodbc.org
+ \title http://www.unixodbc.org
+*/
+
+/*!
+ \externalpage http://www.postgresql.org
+ \title http://www.postgresql.org
+*/
+
+/*!
+ \externalpage http://www.postgresql.org/docs/current/static/installation-platform-notes.html#INSTALLATION-NOTES-MINGW
+ \title PostgreSQL MinGW/Native Windows
+*/
+
+/*!
+ \externalpage http://www.freetds.org
+ \title http://www.freetds.org
+*/
+
+/*!
+ \externalpage http://www.sybase.com
+ \title http://www.sybase.com
+*/
+
+/*!
+ \externalpage http://linux.sybase.com
+ \title http://linux.sybase.com
+*/
+
+/*!
+ \externalpage http://www.sqlite.org
+ \title http://www.sqlite.org
+*/
+
+/*!
+ \externalpage http://www.amazon.com/exec/obidos/ASIN/0134436989/trolltech/t
+ \title Threads Primer: A Guide to Multithreaded Programming
+*/
+
+/*!
+ \externalpage http://www.amazon.com/exec/obidos/ASIN/0131900676/trolltech/t
+ \title Thread Time: The Multithreaded Programming Guide
+*/
+
+/*!
+ \externalpage http://www.amazon.com/exec/obidos/ASIN/1565921151/trolltech/t
+ \title Pthreads Programming: A POSIX Standard for Better Multiprocessing
+*/
+
+/*!
+ \externalpage http://www.amazon.com/exec/obidos/ASIN/1565922964/trolltech/t
+ \title Win32 Multithreaded Programming
+*/
+
+/*!
+ \externalpage http://www.phptr.com/content/images/0131872494/samplechapter/blanchette_ch10.pdf
+ \title "Item View Classes" Chapter of C++ GUI Programming with Qt 4
+*/
+
+/*!
+ \externalpage https://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Intro/Intro.html
+ \title Mac OS X Aqua
+*/
+
+/*!
+ \externalpage http://www.kdedevelopers.org/node/2345
+ \title KDE applications
+*/
+
+/*!
+ \externalpage http://cgi.netscape.com/newsref/std/cookie_spec.html
+ \title Netscape Cookie Specification
+*/
+
+/*!
+ \externalpage http://msdn.microsoft.com/en-us/library/ms533046(VS.85).aspx
+ \title Mitigating Cross-site Scripting With HTTP-only Cookies
+*/
+
+/*!
+ \externalpage http://en.tldp.org/HOWTO/Framebuffer-HOWTO.html
+ \title Framebuffer HOWTO
+*/
+
+/*!
+ \externalpage http://wap.trafikanten.no
+ \title Trafikanten
+*/
+
+/*!
+ \externalpage http://www.w3.org/TR/scxml/
+ \title State Chart XML: State Machine Notation for Control Abstraction
+*/
+
+/*!
+ \externalpage http://www.wisdom.weizmann.ac.il/~dharel/SCANNED.PAPERS/Statecharts.pdf
+ \title Statecharts: A visual formalism for complex systems
+*/
+
+/*!
+ \externalpage http://www.gnu.org/licenses/gpl.html
+ \title GNU General Public License
+*/
+
+/*!
+ \externalpage http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
+ \title GNU Lesser General Public License, version 2.1
+*/
+
+/*!
+ \externalpage http://developers.sun.com/sunstudio/downloads/patches/index.jsp
+ \title Sun Studio Patches
+*/
+
+/*!
+ \externalpage http://www.qtcentre.org
+ \title Qt Centre
+*/
+
+/*!
+ \externalpage http://www.kde.org
+ \title KDE
+*/
+
+/*!
+ \externalpage http://www.directfb.org/index.php?path=Main%2FDownloads&page=1
+ \title DirectFB - df_window example
+*/
+
+/*!
+ \externalpage http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBPalette.html
+ \title DirectFB - IDirectFBPalette
+*/
+
+/*!
+ \externalpage http://www.cplusplus.com/reference/clibrary/cstring/memcpy/
+ \title C++ Reference - memcpy
+*/
+
+/*!
+ \externalpage http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFB_CreateInputEventBuffer.html
+ \title DirectFB - CreateInputEventBuffer
+*/
+
+/*!
+ \externalpage http://www.directfb.org/docs/DirectFB_Reference_1_4/types.html#DFBSurfaceBlittingFlags
+ \title DirectFB - DFBSurfaceBlittingFlags
+*/
+
+/*!
+ \externalpage http://directfb.org/docs/DirectFB_Reference_1_4/IDirectFBImageProvider.html
+ \title DirectFB - IDirectFBImageProvider
+*/
+
+/*!
+ \externalpage http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBSurface.html
+ \title DirectFB - IDirectFBSurface
+*/
+
+/*!
+ \externalpage http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBWindow
+ \title DirectFB - IDirectFBWindow
+*/
+
+/*!
+ \externalpage http://www.directfb.org/docs/DirectFB_Reference_1_4/types.html#DFBSurfaceDescription
+ \title DirectFB - DFBSurfaceDescription
+*/
+
+/*!
+ \externalpage http://www.w3.org/TR/REC-CSS2/selector.html#q1
+ \title Standard CSS2 selector
+*/
+
+/*!
+ \externalpage http://www.w3.org/XML/Schema
+ \title XML Schema
+*/
+
+/*!
+ \externalpage http://opensource.org/licenses/bsd-license.php
+ \title New and Modified BSD Licenses
+*/
+
+/*!
+ \externalpage http://www.ecma-international.org/publications/standards/Ecma-262.htm
+ \title ECMAScript Language Specification
+*/
+
+/*!
+ \externalpage https://developer.mozilla.org/en/JavaScript
+ \title JavaScript Resources
+*/
+
+/*!
+ \externalpage https://developer.mozilla.org/en/JavaScript/Guide
+ \title JavaScript Guide
+*/
+
+/*!
+ \externalpage https://developer.mozilla.org/en/JavaScript/About_JavaScript
+ \title About JavaScript
+*/
+
+/*!
+ \externalpage http://www.libusb.org/
+ \title libusb
+*/
+
+/*!
+ \externalpage https://developer.mozilla.org/en/JavaScript/Reference/Reserved_Words
+ \title JavaScript Reserved Words
+*/
+
+/*!
+ \externalpage http://publicsuffix.org/
+ \title publicsuffix.org
+*/
+
+/*!
+ \externalpage http://wiki.forum.nokia.com/
+ \title Forum Nokia Wiki
+*/
+
+/*!
+ \externalpage http://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/_accessible_event_i_d_8idl.html
+ \title AccessibleEventID.idl File Reference
+*/
+
+/*!
+ \externalpage http://msdn.microsoft.com/en-us/library/dd318066.aspx
+ \title Microsoft Active Accessibility Event Constants
+*/
+
+/*!
+ \externalpage ftp://ftp.qt.nokia.com/pub/qt/solutions/lgpl/qtmotifextension-2.7_1-opensource.tar.gz
+ \title Motif Extension
+*/
+
+/*!
+ \externalpage http://www.opengl.org/registry/
+ \title OpenGL Registry
+*/
+
+/*!
+ \externalpage http://www.khronos.org/registry/gles/
+ \title Khronos OpenGL ES API Registry
+*/
+
+/*!
+ \externalpage http://git.iksaif.net/?p=qsslkey-p11.git
+ \title qsslkey example
+*/
diff --git a/doc/global/externalsites/qch-urls.qdoc b/doc/global/externalsites/qch-urls.qdoc
new file mode 100644
index 0000000000..13f627d943
--- /dev/null
+++ b/doc/global/externalsites/qch-urls.qdoc
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \externalpage http://doc.qt.digia.com/qtcreator/creator-qml-application.html
+ \title external: Developing Qt Quick Applications with Creator
+*/
+/*!
+ \externalpage http://doc.qt.digia.com/qtcreator/creator-visual-editor.html
+ \title external: Developing Qt Quick Applications
+*/
+/*!
+ \externalpage http://doc.qt.digia.com/qtcreator/creator-publish-ovi.html
+ \title external: Publishing Applications to Ovi Store
+*/
+/*!
+ \externalpage http://doc.qt.digia.com/qtcreator/index.html
+ \title external: Qt Creator Manual
+*/
+/*!
+ \externalpage http://doc.qt.digia.com/qtmobility/index.html
+ \title external: Qt Mobility Manual
+*/
+/*!
+ \externalpage http://doc.qt.digia.com/qtmobility/qml-plugins.html
+ \title external: Qt Mobility QML Plugins
+*/
+/*!
+ \externalpage http://qt-project.org/doc/qtcreator/creator-project-managing.html
+ \title external: Creating Qt Projects in Creator
+*/
+/*!
+ \externalpage http://qt-project.org/doc/qtcreator/creator-building-running.html
+ \title external: Building and Running Applications in Creator
+*/
+/*!
+ \externalpage http://qt-project.org/doc/qtcreator/creator-running-targets.html
+ \title external: Set Compiler Targets in Creator
+*/
+/*!
+ \externalpage http://qt-project.org/doc/qtcreator/creator-build-settings.html
+ \title external: Build Settings in Creator
+*/
+/*!
+ \externalpage http://qt-project.org/doc/qtcreator/creator-run-settings.html
+ \title external: Run Settings in Creator
+*/
+/*!
+ \externalpage http://qt-project.org/doc/qtcreator/creator-using-qt-designer.html
+ \title external: Designer in Creator
+*/
+/*!
+ \externalpage http://qt-project.org/doc/qtcreator/creator-debugging.html
+ \title external: Debugging Applications in Creator
+*/
+/*!
+ \externalpage http://doc.qt.digia.com/qtmobility/multimedia.html
+ \title external: Mobility Multimedia
+*/
+/*!
+ \externalpage http://doc.qt.digia.com/qtmobility/location-overview.html
+ \title external: Mobility Location
+*/
+/*!
+ \externalpage http://doc.qt.digia.com/qtmobility/all-examples.html
+ \title external: Qt Mobility Examples
+*/
+/*!
+ \externalpage http://doc-snapshot.qt-project.org/qtcreator-2.6/creator-overview.html
+ \title external: Qt Creator Overview
+*/
diff --git a/doc/global/externalsites/qt-webpages.qdoc b/doc/global/externalsites/qt-webpages.qdoc
new file mode 100644
index 0000000000..dfc0ab04a2
--- /dev/null
+++ b/doc/global/externalsites/qt-webpages.qdoc
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/*!
+ \externalpage http://qt-project.org/
+ \title Qt Homepage
+*/
+/*!
+ \externalpage http://bugreports.qt-project.org
+ \title Qt Bug Tracker
+*/
+/*!
+ \externalpage http://qt.digia.com/downloads
+ \title Downloads
+*/
+/*!
+ \externalpage http://qt.digia.com/products/licensing/
+ \title Qt Licensing Overview
+*/
+/*!
+ \externalpage http://doc.qt.digia.com/qq/
+ \title Qt Quarterly
+*/
+/*!
+ \externalpage http://doc.qt.digia.com/qq/qq19-plurals.html
+ \title Qt Quarterly: Plural Form in Translation
+*/
+/*!
+ \externalpage http://qt.gitorious.org
+ \title Public Qt Repository
+*/
+/*!
+ \externalpage http://qt.gitorious.org/qt-labs/qtestlib-tools
+ \title qtestlib-tools
+*/
+
+/*!
+ \externalpage http://qt-project.org/wiki/Qt_Coding_Style
+ \title Qt Coding Style
+*/
+/*!
+ \externalpage http://doc.qt.digia.com/qt-eclipse-1.6/index.html
+ \title Eclipse Plugin
+*/
+/*!
+ \externalpage http://doc.qt.digia.com/qq/qq11-events.html
+ \title Qt Quarterly: Another Look at Events
+*/
+/*!
+ \externalpage http://qt-project.org/videos/watch/livecoding-video-effects-with-qt5
+ \title Livecoding video effects with Qt5
+*/
+/*!
+ \externalpage http://blog.qt.digia.com/2012/02/29/pimp-my-video-shader-effects-and-multimedia/
+ \title Pimp my video
+*/
+/*!
+ \externalpage http://qt-project.org/wiki/QtMediaHub
+ \title QtMediaHub
+*/
+/*!
+ \externalpage http://qt-project.org/wiki/Qt-RaspberryPi
+ \title QtonPi
+*/
+
+/*!
+ \externalpage http://qt-project.org/wiki/jom
+ \title jom
+*/
diff --git a/doc/global/externalsites/rfc.qdoc b/doc/global/externalsites/rfc.qdoc
new file mode 100644
index 0000000000..82d6f0cef8
--- /dev/null
+++ b/doc/global/externalsites/rfc.qdoc
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \externalpage http://www.ietf.org/rfc/rfc1179.txt
+ \title RFC 1179
+ \keyword lpr
+*/
+
+/*!
+ \externalpage http://www.rfc-editor.org/rfc/rfc1738.txt
+ \title RFC 1738
+*/
+
+/*!
+ \externalpage http://www.rfc-editor.org/rfc/rfc1928.txt
+ \title RFC 1928
+*/
+
+/*!
+ \externalpage http://www.rfc-editor.org/rfc/rfc1929.txt
+ \title RFC 1929
+*/
+
+/*!
+ \externalpage http://www.rfc-editor.org/rfc/rfc2045.txt
+ \title RFC 2045
+*/
+
+/*!
+ \externalpage http://www.rfc-editor.org/rfc/rfc2109.txt
+ \title RFC 2109
+ HTTP State Management Mechanism
+*/
+
+/*!
+ \externalpage http://www.rfc-editor.org/rfc/rfc2965.txt
+ \title RFC 2965
+ HTTP State Management Mechanism
+*/
+
+/*!
+ \externalpage http://www.rfc-editor.org/rfc/rfc3174.txt
+ \title RFC 3174
+*/
+
+/*!
+ \externalpage http://www.rfc-editor.org/rfc/rfc3491.txt
+ \title RFC 3491
+*/
+
+/*!
+ \externalpage http://www.rfc-editor.org/rfc/rfc3986.txt
+ \title RFC 3986
+*/
diff --git a/doc/global/macros.qdocconf b/doc/global/macros.qdocconf
new file mode 100644
index 0000000000..fd3707a27c
--- /dev/null
+++ b/doc/global/macros.qdocconf
@@ -0,0 +1,37 @@
+macro.aacute.HTML = "á"
+macro.Aring.HTML = "Å"
+macro.aring.HTML = "å"
+macro.Auml.HTML = "Ä"
+macro.author = "\\b{Author:}"
+macro.br.HTML = "<br />"
+macro.BR.HTML = "<br />"
+macro.copyright.HTML = "&copy;"
+macro.eacute.HTML = "&eacute;"
+macro.gui = "\\b"
+macro.hr.HTML = "<hr />"
+macro.iacute.HTML = "&iacute;"
+macro.key = "\\b"
+macro.menu = "\\b"
+macro.oslash.HTML = "&oslash;"
+macro.ouml.HTML = "&ouml;"
+macro.QA = "\\e{Qt Assistant}"
+macro.QD = "\\e{Qt Designer}"
+macro.QL = "\\e{Qt Linguist}"
+macro.QQV = "\\e{Qt QML Viewer}"
+macro.param = "\\e"
+macro.raisedaster.HTML = "<sup>*</sup>"
+macro.rarrow.HTML = "&rarr;"
+macro.reg.HTML = "<sup>&reg;</sup>"
+macro.return = "Returns"
+macro.starslash = "\\c{*/}"
+macro.begincomment = "\\c{/*}"
+macro.endcomment = "\\c{*/}"
+macro.uuml.HTML = "&uuml;"
+macro.mdash.HTML = "&mdash;"
+macro.pi.HTML = "&Pi;"
+
+macro.beginfloatleft.HTML = "<div style=\"float: left; margin-right: 2em\">"
+macro.beginfloatright.HTML = "<div style=\"float: right; margin-left: 2em\">"
+macro.endfloat.HTML = "</div>"
+macro.clearfloat.HTML = "<br style=\"clear: both\" />"
+macro.emptyspan.HTML = "<span></span>"
diff --git a/doc/global/qt-cpp-ignore.qdocconf b/doc/global/qt-cpp-ignore.qdocconf
new file mode 100644
index 0000000000..6dd1536c1f
--- /dev/null
+++ b/doc/global/qt-cpp-ignore.qdocconf
@@ -0,0 +1,116 @@
+Cpp.ignoretokens += \
+ PHONON_EXPORT \
+ Q_AUTOTEST_EXPORT \
+ Q_BLUETOOTH_EXPORT \
+ Q_COMPAT_EXPORT \
+ Q_CORE_EXPORT \
+ Q_CORE_EXPORT_INLINE \
+ Q_DBUS_EXPORT \
+ Q_DECL_CONSTEXPR \
+ Q_DECL_NOEXCEPT \
+ Q_DECL_NOTHROW \
+ Q_DECLARATIVE_EXPORT \
+ Q_EXPLICIT \
+ Q_EXPORT \
+ Q_EXPORT_CODECS_CN \
+ Q_EXPORT_CODECS_JP \
+ Q_EXPORT_CODECS_KR \
+ Q_EXPORT_PLUGIN \
+ Q_EXPORT_PLUGIN2 \
+ Q_GADGET \
+ Q_GFX_INLINE \
+ Q_GUI_EXPORT \
+ Q_GUI_EXPORT_INLINE \
+ Q_GUI_EXPORT_STYLE_CDE \
+ Q_GUI_EXPORT_STYLE_COMPACT \
+ Q_GUI_EXPORT_STYLE_MAC \
+ Q_GUI_EXPORT_STYLE_MOTIF \
+ Q_GUI_EXPORT_STYLE_MOTIFPLUS \
+ Q_GUI_EXPORT_STYLE_PLATINUM \
+ Q_GUI_EXPORT_STYLE_POCKETPC \
+ Q_GUI_EXPORT_STYLE_SGI \
+ Q_GUI_EXPORT_STYLE_WINDOWS \
+ Q_GUI_EXPORT_STYLE_WINDOWSXP \
+ Q_INLINE_TEMPLATE \
+ Q_INTERNAL_WIN_NO_THROW \
+ Q_INVOKABLE \
+ Q_LOCATION_EXPORT \
+ Q_MULTIMEDIA_EXPORT \
+ Q_NETWORK_EXPORT \
+ Q_OPENGL_EXPORT \
+ Q_OPENVG_EXPORT \
+ Q_OUTOFLINE_TEMPLATE \
+ Q_PRINTSUPPORT_EXPORT \
+ Q_SCRIPT_EXPORT \
+ Q_SCRIPTTOOLS_EXPORT \
+ Q_SQL_EXPORT \
+ Q_SVG_EXPORT \
+ Q_TESTLIB_EXPORT \
+ Q_TYPENAME \
+ Q_WIDGETS_EXPORT \
+ Q_XML_EXPORT \
+ Q_XMLPATTERNS_EXPORT \
+ Q_XMLSTREAM_EXPORT \
+ QAXFACTORY_EXPORT \
+ QDBUS_EXPORT \
+ QDESIGNER_COMPONENTS_LIBRARY \
+ QDESIGNER_EXTENSION_LIBRARY \
+ QDESIGNER_SDK_LIBRARY \
+ QDESIGNER_SHARED_LIBRARY \
+ QDESIGNER_UILIB_LIBRARY \
+ QHELP_EXPORT \
+ QM_AUTOTEST_EXPORT \
+ QM_EXPORT_CANVAS \
+ QM_EXPORT_DNS \
+ QM_EXPORT_DOM \
+ QM_EXPORT_FTP \
+ QM_EXPORT_HTTP \
+ QM_EXPORT_ICONVIEW \
+ QM_EXPORT_NETWORK \
+ QM_EXPORT_OPENGL \
+ QM_EXPORT_OPENVG \
+ QM_EXPORT_SQL \
+ QM_EXPORT_TABLE \
+ QM_EXPORT_WORKSPACE \
+ QM_EXPORT_XML \
+ QT_ASCII_CAST_WARN \
+ QT_ASCII_CAST_WARN_CONSTRUCTOR \
+ QT_BEGIN_HEADER \
+ QT_BEGIN_INCLUDE_NAMESPACE \
+ QT_BEGIN_NAMESPACE \
+ QT_BOOTSTRAPPED \
+ QT_DESIGNER_STATIC \
+ QT_END_HEADER \
+ QT_END_INCLUDE_NAMESPACE \
+ QT_END_NAMESPACE \
+ QT_FASTCALL \
+ QT_WIDGET_PLUGIN_EXPORT \
+ QTBLUETOOTH_BEGIN_NAMESPACE \
+ QTBLUETOOTH_END_NAMESAPCE \
+ QTNFC_BEGIN_NAMESPACE \
+ QTNFC_END_NAMESPACE \
+ QWEBKIT_EXPORT
+
+Cpp.ignoredirectives = \
+ __attribute__ \
+ K_DECLARE_PRIVATE \
+ PHONON_HEIR \
+ PHONON_OBJECT \
+ Q_CLASSINFO \
+ Q_DECLARE_INTERFACE \
+ Q_DECLARE_METATYPE \
+ Q_DECLARE_OPERATORS_FOR_FLAGS \
+ Q_DECLARE_PRIVATE \
+ Q_DECLARE_PRIVATE_D \
+ Q_DECLARE_PUBLIC \
+ Q_DECLARE_SHARED \
+ Q_DECLARE_TR_FUNCTIONS \
+ Q_DECLARE_TYPEINFO \
+ Q_DISABLE_COPY \
+ Q_DUMMY_COMPARISON_OPERATOR \
+ Q_ENUMS \
+ Q_FLAGS \
+ Q_INTERFACES \
+ Q_PRIVATE_PROPERTY \
+ QT_FORWARD_DECLARE_CLASS \
+ Q_DECLARE_HANDLE
diff --git a/doc/global/qt-defines.qdocconf b/doc/global/qt-defines.qdocconf
new file mode 100644
index 0000000000..79b13eee92
--- /dev/null
+++ b/doc/global/qt-defines.qdocconf
@@ -0,0 +1,17 @@
+versionsym = QT_VERSION_STR
+
+defines += Q_QDOC \
+ QT_.*_SUPPORT \
+ QT_.*_LIB \
+ QT_COMPAT \
+ QT_KEYPAD_NAVIGATION \
+ QT_NO_EGL \
+ QT3_SUPPORT \
+ Q_WS_.* \
+ Q_OS_.* \
+ Q_BYTE_ORDER \
+ QT_DEPRECATED \
+ QT_DEPRECATED_* \
+ Q_NO_USING_KEYWORD \
+ __cplusplus \
+ Q_COMPILER_INITIALIZER_LISTS
diff --git a/doc/global/qt-html-templates-offline.qdocconf b/doc/global/qt-html-templates-offline.qdocconf
index 9f2d28fa28..d608bb3a76 100644
--- a/doc/global/qt-html-templates-offline.qdocconf
+++ b/doc/global/qt-html-templates-offline.qdocconf
@@ -1,14 +1,21 @@
HTML.nobreadcrumbs = "true"
-HTML.stylesheets = global/style/offline.css
+HTML.stylesheets = template/style/offline.css
HTML.headerstyles = \
" <link rel=\"stylesheet\" type=\"text/css\" href=\"style/offline.css\" />\n"
HTML.endheader = \
"</head>\n" \
+ "<body>\n" \
+ "<div class=\"content\">\n" \
+ "<div class=\"line\">\n" \
+ "<div class=\"content mainContent\">\n" \
HTML.footer = \
+ "</div>\n" \
+ "</div>\n" \
+ "</div>\n" \
"<div class=\"footer\">\n" \
" <p>\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2012 Digia Plc and/or its\n" \
@@ -29,4 +36,3 @@ HTML.footer = \
" of their respective owners. <a title=\"Privacy Policy\"\n" \
" href=\"http://en.gitorious.org/privacy_policy/\">Privacy Policy</a></p>\n" \
"</div>\n" \
-
diff --git a/doc/global/qt-html-templates-online.qdocconf b/doc/global/qt-html-templates-online.qdocconf
new file mode 100644
index 0000000000..387404aaf3
--- /dev/null
+++ b/doc/global/qt-html-templates-online.qdocconf
@@ -0,0 +1,95 @@
+HTML.nobreadcrumbs = "true"
+
+HTML.stylesheets = template/style/online.css
+HTML.extraimages = template/images/btn_next_green.png \
+ template/images/box_bg.png \
+ template/images/page.png \
+ template/images/arrow_down.png \
+ template/images/btn_prev.png \
+ template/images/blu_dot.png \
+ template/images/ico_note_attention.png \
+ template/images/btn_prev_green.png \
+ template/images/bg_ll_blank.png \
+ template/images/btn_next.png \
+ template/images/bg_l_blank.png \
+ template/images/ico_note.png \
+ template/images/home.png \
+ template/images/ico_out.png \
+ template/images/header_bg.png \
+ template/images/page_bg.png \
+ template/images/bg_l.png \
+ template/images/bg_r.png \
+ template/images/breadcrumb.png \
+ template/images/bullet_dn.png \
+ template/images/feedbackground.png \
+ template/images/bullet_gt.png \
+ template/images/arrow.png \
+ template/images/bullet_sq.png \
+ template/images/bullet_up.png \
+ template/images/sprites-combined.png \
+ template/images/horBar.png \
+ template/images/bg_ul_blank.png \
+ template/images/bgrContent.png \
+
+
+HTML.headerstyles = \
+ " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/online.css\" />\n"
+
+HTML.endheader = \
+ "</head>\n" \
+ "<body>\n" \
+ " <header>\n" \
+ " <div class=\"nav\">\n" \
+ " <a href=\"http://qt-project.org/\">Qt Home</a>\n" \
+ " <a href=\"https://bugreports.qt-project.org/\">Bug Tracker</a>\n" \
+ " <a href=\"https://codereview.qt-project.org/\">Code Review</a>\n" \
+ " </div>\n" \
+ " <a href=\"http://qt-project.org/\">\n" \
+ " <img src=\"http://doc-snapshot.qt-project.org/images/logo.png\" alt=\"Qt\"></img>\n" \
+ " </a>\n" \
+ " <div class=\"nav-title\">\n" \
+ " <h1 >Qt Documentation Snapshots</h1>\n" \
+ " <div class=\"nav-subtitle\">\n" \
+ " --snapshots of unreleased Qt documentation\n" \
+ " </div>\n" \
+ " </div>\n" \
+ " <div class=\"nav-main\">\n" \
+ " <div class=\"nav-main-content\">\n" \
+ " <a href=\"http://doc-snapshot.qt-project.org\">All Modules</a>\n" \
+ " </div>\n" \
+ " <div class=\"nav-main-content\">\n" \
+ " <a href=\"http://qt-project.org/doc\">Qt Releases</a>\n" \
+ " </div>\n" \
+ " <div class=\"nav-main-content\">\n" \
+ " <a href=\"http://doc.qt.digia.com\">Archives</a>\n" \
+ " </div>\n" \
+ " </div>\n" \
+ "</header>\n" \
+ "<div class=\"content\">\n" \
+ " <div class=\"line\">\n" \
+ " <div class=\"content mainContent\">\n" \
+
+HTML.footer = \
+ " </div>\n" \
+ " </div>\n" \
+ "</div>\n" \
+ "<div class=\"footer\">\n" \
+ " <p>\n" \
+ " <acronym title=\"Copyright\">&copy;</acronym> 2012 Digia Plc and/or its\n" \
+ " subsidiaries. Documentation contributions included herein are the copyrights of\n" \
+ " their respective owners.</p>\n" \
+ " <br />\n" \
+ " <p>\n" \
+ " The documentation provided herein is licensed under the terms of the\n" \
+ " <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU Free Documentation\n" \
+ " License version 1.3</a> as published by the Free Software Foundation.</p>\n" \
+ " <p>\n" \
+ " Documentation sources may be obtained from <a href=\"http://www.qt-project.org\">\n" \
+ " www.qt-project.org</a>.</p>\n" \
+ " <br />\n" \
+ " <p>\n" \
+ " Digia, Qt and their respective logos are trademarks of Digia Plc \n" \
+ " in Finland and/or other countries worldwide. All other trademarks are property\n" \
+ " of their respective owners. <a title=\"Privacy Policy\"\n" \
+ " href=\"http://en.gitorious.org/privacy_policy/\">Privacy Policy</a></p>\n" \
+ "</div>\n" \
diff --git a/doc/global/qt-module-defaults-online.qdocconf b/doc/global/qt-module-defaults-online.qdocconf
new file mode 100644
index 0000000000..b42b4c4f13
--- /dev/null
+++ b/doc/global/qt-module-defaults-online.qdocconf
@@ -0,0 +1,32 @@
+include(macros.qdocconf)
+include(qt-cpp-ignore.qdocconf)
+include(qt-defines.qdocconf)
+include(qt-html-templates-online.qdocconf)
+include(compat.qdocconf)
+
+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 = Digia Plc
+dita.metadata.default.audience = programmer
+
+naturallanguage = en_US
+outputencoding = UTF-8
+sourceencoding = UTF-8
+
+examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml *.css"
+examples.imageextensions = "*.png *.jpg *.gif"
+
+headers.fileextensions = "*.ch *.h *.h++ *.hh *.hpp *.hxx"
+sources.fileextensions = "*.c++ *.cc *.cpp *.cxx *.mm *.qml *.qdoc"
+
+versionsym = QT_VERSION_STR
+
+macro.raisedaster.HTML = "<sup>*</sup>"
+
+#for including files into the qch file
+qhp.extraFiles += template/style/online.css
+
+#include the external websites
+sourcedirs += externalsites
diff --git a/doc/global/qt-module-defaults.qdocconf b/doc/global/qt-module-defaults.qdocconf
index 4532af5264..32ac79628c 100644
--- a/doc/global/qt-module-defaults.qdocconf
+++ b/doc/global/qt-module-defaults.qdocconf
@@ -1,80 +1,8 @@
-codeindent = 1
-
-Cpp.ignoretokens = \
- QDBUS_EXPORT \
- QT_ASCII_CAST_WARN \
- QT_ASCII_CAST_WARN_CONSTRUCTOR \
- QT_BEGIN_HEADER \
- QT_BEGIN_INCLUDE_NAMESPACE \
- QT_BEGIN_NAMESPACE \
- QT_BOOTSTRAPPED \
- QT_DESIGNER_STATIC \
- QT_END_HEADER \
- QT_END_INCLUDE_NAMESPACE \
- QT_END_NAMESPACE \
- QT_FASTCALL \
- Q_AUTOTEST_EXPORT \
- Q_COMPAT_EXPORT \
- Q_CORE_EXPORT \
- Q_CORE_EXPORT_INLINE \
- Q_DBUS_EXPORT \
- Q_DECL_CONSTEXPR \
- Q_DECL_NOEXCEPT \
- Q_DECL_NOTHROW \
- Q_EXPORT \
- Q_EXPORT_PLUGIN \
- Q_EXPORT_PLUGIN2 \
- Q_GADGET \
- Q_GUI_EXPORT \
- Q_GUI_EXPORT_INLINE \
- Q_INLINE_TEMPLATE \
- Q_INVOKABLE \
- Q_NETWORK_EXPORT \
- Q_OPENGL_EXPORT \
- Q_OPENVG_EXPORT \
- Q_OUTOFLINE_TEMPLATE \
- Q_PRINTSUPPORT_EXPORT \
- Q_SQL_EXPORT \
- Q_SVG_EXPORT \
- Q_SCRIPT_EXPORT \
- Q_SCRIPTTOOLS_EXPORT \
- Q_WIDGETS_EXPORT \
- Q_XML_EXPORT \
- Q_XMLPATTERNS_EXPORT
-
-Cpp.ignoredirectives = \
- __attribute__ \
- QT_FORWARD_DECLARE_CLASS \
- Q_CLASSINFO \
- Q_DECLARE_INTERFACE \
- Q_DECLARE_METATYPE \
- Q_DECLARE_OPERATORS_FOR_FLAGS \
- Q_DECLARE_PRIVATE \
- Q_DECLARE_PUBLIC \
- Q_DECLARE_PRIVATE_D \
- Q_DECLARE_SHARED \
- Q_DECLARE_TR_FUNCTIONS \
- Q_DECLARE_TYPEINFO \
- Q_DISABLE_COPY \
- Q_DUMMY_COMPARISON_OPERATOR \
- Q_ENUMS \
- Q_FLAGS \
- Q_INTERFACES \
- Q_PRIVATE_PROPERTY
-
-defines = Q_QDOC \
- QT_.*_SUPPORT \
- QT_.*_LIB \
- QT_COMPAT \
- QT_KEYPAD_NAVIGATION \
- QT_NO_EGL \
- Q_OS_.* \
- Q_BYTE_ORDER \
- QT_DEPRECATED \
- QT_DEPRECATED_* \
- Q_NO_USING_KEYWORD \
- __cplusplus \
- Q_COMPILER_INITIALIZER_LISTS
+include(macros.qdocconf)
+include(qt-cpp-ignore.qdocconf)
+include(qt-defines.qdocconf)
+include(qt-html-templates-offline.qdocconf)
+include(compat.qdocconf)
dita.metadata.default.author = Qt Project
dita.metadata.default.permissions = all
@@ -95,3 +23,10 @@ sources.fileextensions = "*.c++ *.cc *.cpp *.cxx *.mm *.qml *.qdoc"
versionsym = QT_VERSION_STR
+macro.raisedaster.HTML = "<sup>*</sup>"
+
+#for including files into the qch file
+qhp.extraFiles += template/style/offline.css
+
+#include the external websites
+sourcedirs += externalsites
diff --git a/doc/global/template/images/arrow.png b/doc/global/template/images/arrow.png
new file mode 100755
index 0000000000..f2a83a5740
--- /dev/null
+++ b/doc/global/template/images/arrow.png
Binary files differ
diff --git a/doc/global/template/images/arrow_down.png b/doc/global/template/images/arrow_down.png
new file mode 100644
index 0000000000..9d01e97f6a
--- /dev/null
+++ b/doc/global/template/images/arrow_down.png
Binary files differ
diff --git a/doc/global/template/images/bg_l.png b/doc/global/template/images/bg_l.png
new file mode 100755
index 0000000000..90b1da10b9
--- /dev/null
+++ b/doc/global/template/images/bg_l.png
Binary files differ
diff --git a/doc/global/template/images/bg_l_blank.png b/doc/global/template/images/bg_l_blank.png
new file mode 100755
index 0000000000..5a9673d81b
--- /dev/null
+++ b/doc/global/template/images/bg_l_blank.png
Binary files differ
diff --git a/doc/global/template/images/bg_ll_blank.png b/doc/global/template/images/bg_ll_blank.png
new file mode 100644
index 0000000000..95a1c45e04
--- /dev/null
+++ b/doc/global/template/images/bg_ll_blank.png
Binary files differ
diff --git a/doc/global/template/images/bg_r.png b/doc/global/template/images/bg_r.png
new file mode 100755
index 0000000000..f0fb121dea
--- /dev/null
+++ b/doc/global/template/images/bg_r.png
Binary files differ
diff --git a/doc/global/template/images/bg_ul_blank.png b/doc/global/template/images/bg_ul_blank.png
new file mode 100644
index 0000000000..70512614cc
--- /dev/null
+++ b/doc/global/template/images/bg_ul_blank.png
Binary files differ
diff --git a/doc/global/template/images/bgrContent.png b/doc/global/template/images/bgrContent.png
new file mode 100755
index 0000000000..1a81b03087
--- /dev/null
+++ b/doc/global/template/images/bgrContent.png
Binary files differ
diff --git a/doc/global/template/images/blu_dot.png b/doc/global/template/images/blu_dot.png
new file mode 100755
index 0000000000..c332148f74
--- /dev/null
+++ b/doc/global/template/images/blu_dot.png
Binary files differ
diff --git a/doc/global/template/images/box_bg.png b/doc/global/template/images/box_bg.png
new file mode 100755
index 0000000000..3322f923f8
--- /dev/null
+++ b/doc/global/template/images/box_bg.png
Binary files differ
diff --git a/doc/global/template/images/breadcrumb.png b/doc/global/template/images/breadcrumb.png
new file mode 100755
index 0000000000..0ded5514d2
--- /dev/null
+++ b/doc/global/template/images/breadcrumb.png
Binary files differ
diff --git a/doc/global/template/images/btn_next.png b/doc/global/template/images/btn_next.png
new file mode 100755
index 0000000000..f7bc2b7170
--- /dev/null
+++ b/doc/global/template/images/btn_next.png
Binary files differ
diff --git a/doc/global/template/images/btn_next_green.png b/doc/global/template/images/btn_next_green.png
new file mode 100644
index 0000000000..c649f18572
--- /dev/null
+++ b/doc/global/template/images/btn_next_green.png
Binary files differ
diff --git a/doc/global/template/images/btn_prev.png b/doc/global/template/images/btn_prev.png
new file mode 100755
index 0000000000..10a620c518
--- /dev/null
+++ b/doc/global/template/images/btn_prev.png
Binary files differ
diff --git a/doc/global/template/images/btn_prev_green.png b/doc/global/template/images/btn_prev_green.png
new file mode 100644
index 0000000000..d1d29895b2
--- /dev/null
+++ b/doc/global/template/images/btn_prev_green.png
Binary files differ
diff --git a/doc/global/template/images/bullet_dn.png b/doc/global/template/images/bullet_dn.png
new file mode 100644
index 0000000000..f7762472e2
--- /dev/null
+++ b/doc/global/template/images/bullet_dn.png
Binary files differ
diff --git a/doc/global/template/images/bullet_gt.png b/doc/global/template/images/bullet_gt.png
new file mode 100755
index 0000000000..7561b4edc4
--- /dev/null
+++ b/doc/global/template/images/bullet_gt.png
Binary files differ
diff --git a/doc/global/template/images/bullet_sq.png b/doc/global/template/images/bullet_sq.png
new file mode 100755
index 0000000000..a84845e3c7
--- /dev/null
+++ b/doc/global/template/images/bullet_sq.png
Binary files differ
diff --git a/doc/global/template/images/bullet_up.png b/doc/global/template/images/bullet_up.png
new file mode 100644
index 0000000000..7de2f06954
--- /dev/null
+++ b/doc/global/template/images/bullet_up.png
Binary files differ
diff --git a/doc/global/template/images/feedbackground.png b/doc/global/template/images/feedbackground.png
new file mode 100755
index 0000000000..3a38d995d7
--- /dev/null
+++ b/doc/global/template/images/feedbackground.png
Binary files differ
diff --git a/doc/global/template/images/header_bg.png b/doc/global/template/images/header_bg.png
new file mode 100644
index 0000000000..a436aa61ef
--- /dev/null
+++ b/doc/global/template/images/header_bg.png
Binary files differ
diff --git a/doc/global/template/images/home.png b/doc/global/template/images/home.png
new file mode 100755
index 0000000000..8de6d0c81f
--- /dev/null
+++ b/doc/global/template/images/home.png
Binary files differ
diff --git a/doc/global/template/images/horBar.png b/doc/global/template/images/horBar.png
new file mode 100755
index 0000000000..100fe91c6c
--- /dev/null
+++ b/doc/global/template/images/horBar.png
Binary files differ
diff --git a/doc/global/template/images/ico_note.png b/doc/global/template/images/ico_note.png
new file mode 100755
index 0000000000..13794046cf
--- /dev/null
+++ b/doc/global/template/images/ico_note.png
Binary files differ
diff --git a/doc/global/template/images/ico_note_attention.png b/doc/global/template/images/ico_note_attention.png
new file mode 100755
index 0000000000..b85b696b10
--- /dev/null
+++ b/doc/global/template/images/ico_note_attention.png
Binary files differ
diff --git a/doc/global/template/images/ico_out.png b/doc/global/template/images/ico_out.png
new file mode 100755
index 0000000000..ff6e458fb1
--- /dev/null
+++ b/doc/global/template/images/ico_out.png
Binary files differ
diff --git a/doc/global/template/images/page.png b/doc/global/template/images/page.png
new file mode 100644
index 0000000000..1db151bd31
--- /dev/null
+++ b/doc/global/template/images/page.png
Binary files differ
diff --git a/doc/global/template/images/page_bg.png b/doc/global/template/images/page_bg.png
new file mode 100755
index 0000000000..9b3bd999df
--- /dev/null
+++ b/doc/global/template/images/page_bg.png
Binary files differ
diff --git a/doc/global/template/images/spinner.gif b/doc/global/template/images/spinner.gif
new file mode 100644
index 0000000000..1ed786f2ec
--- /dev/null
+++ b/doc/global/template/images/spinner.gif
Binary files differ
diff --git a/doc/global/template/images/sprites-combined.png b/doc/global/template/images/sprites-combined.png
new file mode 100755
index 0000000000..3a48b21f6b
--- /dev/null
+++ b/doc/global/template/images/sprites-combined.png
Binary files differ
diff --git a/doc/global/style/offline.css b/doc/global/template/style/offline.css
index 1b430ab904..c7767ad88c 100644
--- a/doc/global/style/offline.css
+++ b/doc/global/template/style/offline.css
@@ -620,3 +620,87 @@ border:none;}
.clearfix{
clear:both;}
+/* start index box */
+.indexbox
+{
+width: 100%;
+display:inline-block;
+}
+
+.indexboxcont
+{
+display: block;
+
+}
+
+.indexboxcont .section
+{
+display: inline-block;
+width: 49%;
+*width:42%;
+_width:42%;
+padding:0 2% 0 1%;
+vertical-align:top;
+}
+
+.indexboxcont .indexIcon
+{
+width: 11%;
+*width:18%;
+_width:18%;
+overflow:hidden;
+}
+
+.indexboxcont .section {
+ float: left;
+}
+
+.indexboxcont .section p
+{
+padding-top: 20px;
+padding-bottom: 20px;
+}
+.indexboxcont .sectionlist
+{
+display: inline-block;
+vertical-align:top;
+width: 32.5%;
+padding: 0;
+}
+.indexboxcont .sectionlist ul
+{
+margin-bottom: 20px;
+}
+
+.indexboxcont .sectionlist ul li
+{
+line-height: 12px;
+}
+
+.content .indexboxcont li
+{
+font: normal bold 13px/1 Verdana;
+}
+
+.content .normallist li
+{
+font: normal 13px/1 Verdana;
+}
+
+.indexbox .indexIcon {
+width: 11%;
+}
+
+.indexbox .indexIcon span
+{
+display: block;
+}
+
+.indexboxcont:after
+{
+content: ".";
+display: block;
+height: 0;
+clear: both;
+visibility: hidden;
+}
diff --git a/doc/global/template/style/online.css b/doc/global/template/style/online.css
new file mode 100644
index 0000000000..6a6e8225c8
--- /dev/null
+++ b/doc/global/template/style/online.css
@@ -0,0 +1,749 @@
+body{
+font: normal 400 14px/1.2 Arial;
+font-family: Arial, Helvetica;
+color:#313131;
+text-align:justify;
+margin-left:5px;
+margin-right:5px;
+background: none repeat scroll 0% 0% rgb(230,231,232);
+}
+
+img{
+-moz-box-shadow: 3px 3px 3px #ccc;
+-webkit-box-shadow: 3px 3px 3px #ccc;
+box-shadow: 3px 3px 3px #ccc;
+border:#8E8D8D 2px solid;
+margin-left:0px;
+max-width: 800px;
+height: auto
+}
+
+b{
+font-weight:600;
+}
+
+.content{}
+
+.descr{
+margin-top:35px;
+/*max-width: 75%;*/
+margin-left:5px;
+text-align:justify;
+vertical-align:top;
+}
+
+.name{
+max-width: 75%;
+font-weight:100;
+}
+
+tt{
+text-align:left;}
+
+/*
+-----------
+links
+-----------
+*/
+
+a:link{
+color: #2C418D;
+text-decoration: none;
+text-align:left;
+}
+
+a:hover{
+color: #869CD1;
+text-decoration:underline;
+text-align:left;
+}
+
+a:visited{
+color: #869CD1;
+text-decoration: none;
+text-align:left;
+}
+
+a:visited:hover{
+text-decoration:underline;
+text-align:left;
+}
+
+.flags{
+text-decoration:none;
+text-height:24px;
+}
+
+/*
+-------------------------------
+NOTE styles
+-------------------------------
+*/
+.notetitle, .tiptitle, .fastpathtitle{
+font-weight:bold;
+}
+
+.attentiontitle,.cautiontitle,.dangertitle,.importanttitle,.remembertitle,.restrictiontitle{
+font-weight:bold;
+}
+
+.note,.tip,.fastpath{
+background: #F2F2F2 url(../images/ico_note.png);
+background-repeat: no-repeat;
+background-position: top left;
+padding:5px;
+padding-left:40px;
+padding-bottom:10px;
+border:#999 1px dotted;
+color:#666666;
+margin:5px;
+}
+
+.attention,.caution,.danger,.important,.remember,.restriction{
+background: #F2F2F2 url(../images/ico_note_attention.png);
+background-repeat:no-repeat;
+background-position:top left;
+padding:5px;
+padding-left:40px;
+padding-bottom:10px;
+border:#999 1px dotted;
+color:#666666;
+margin:5px;
+}
+
+/*
+-------------------------------
+Top navigation
+-------------------------------
+*/
+
+.nav{
+text-align:right;
+margin-right:9px;
+}
+.nav img{
+ box-shadow: none;
+}
+.nav-main{
+margin-top:22px;
+margin-left: 20px;
+text-align:left
+}
+.nav-main-content{
+font-weight:bold;
+margin-right: 20px;
+display:inline-block;
+}
+.nav-subtitle{
+color: #869CD1;
+margin-left: 220px;
+}
+.header{
+height:1px;
+padding:0px;
+margin:0px;
+}
+
+header{
+background: none repeat scroll 0% 0% rgb(255,255,255);
+border-radius: 10px 10px 10px 10px;
+padding: 10px;
+box-shadow: 0px 0px 10px rgba(0,0,0,0.1);
+}
+
+header h1{
+display:block;
+line-height: 70px;
+font-size: 30px;
+margin-left: 223px;
+}
+header img{
+box-shadow: none;
+border: 0;
+position: absolute;
+left: 30px;
+}
+.qtref{
+display: block;
+position: relative;
+top: -76px;
+height:15px;
+z-index: 1;
+font-size:11px;
+padding-right:10px;
+float:right;
+}
+
+.naviNextPrevious{
+display: block;
+text-align: right;
+float:right;
+z-index:1;
+padding-right:10px;
+vertical-align:top;
+}
+
+
+.naviNextPrevious > a.prevPage {
+background-image:url(../images/btn_prev.png);
+background-repeat:no-repeat;
+background-position:left;
+padding-left:20px;
+height:20px;
+padding-left:20px;
+}
+
+.naviNextPrevious > a.nextPage {
+background-image:url(../images/btn_next.png);
+background-repeat:no-repeat;
+background-position:right;
+padding-right:20px;
+height:20px;
+margin-left:30px;
+}
+
+.breadcrumb{
+display: block;
+position: relative;
+top:-20px;
+/*border-top:2px solid #ffffff;*/
+border-bottom: 1px solid #cecece;
+background-color:#F2F2F2;
+z-index:1;
+height:20px;
+padding:0px;
+margin:0px;
+padding-left:10px;
+padding-top:2px;
+margin-left:-5px;
+margin-right:-5px;
+}
+
+.breadcrumb ul{
+ margin:0px;
+ padding:0px;
+}
+
+.breadcrumb ul li{
+background-color:#F2F2F2;
+list-style-type:none;
+padding:0;
+margin:0;
+height:20px;
+}
+
+.breadcrumb li{
+float:left;
+}
+
+.breadcrumb .first {
+background:url(../images/home.png);
+background-position:left;
+background-repeat:no-repeat;
+padding-left:20px;
+}
+
+
+.breadcrumb li a{
+color:#2C418D;
+display:block;
+text-decoration:none;
+background:url(../images/arrow.png);
+background-repeat:no-repeat;
+background-position:right;
+padding-right:25px;
+padding-left:10px;
+}
+
+.breadcrumb li a:hover{
+color:#909090;
+display:block;
+text-decoration:none;
+background:url(../images/arrow.png);
+background-repeat:no-repeat;
+background-position:right;
+padding-right:20px;
+padding-left:10px;
+}
+
+/*
+-----------
+footer and license
+-----------
+*/
+.footer{
+text-align:center
+}
+/*
+-----------
+main content
+-----------
+*/
+.line{
+text-align: left;
+background: none repeat scroll 0% 0% rgb(255,255,255);
+border-radius: 10px 10px 10px 10px;
+padding-left: 14px;
+padding-right: 14px;
+box-shadow: 0px 0px 10px rgba(0,0,0,0.1);
+margin-top: 10px;
+padding-bottom: 35px;
+}
+
+
+/* table of content
+no display
+*/
+
+/*
+-----------
+headers
+-----------
+*/
+
+
+@media screen{
+.title{
+color:#313131;
+font-size: 18px;
+font-weight: normal;
+left: 0;
+padding-bottom: 20px;
+padding-left: 10px;
+padding-top: 20px;
+border-bottom: 1px #CCC solid ;
+font-weight:bold;
+margin-left:0px;
+margin-right:0px;
+}
+}
+
+h1 {
+margin: 0;
+}
+
+h2, p.h2 {
+font: 500 16px/1.2 Arial;
+font-weight:100;
+background-color:#F2F3F4;
+padding:4px;
+padding-left:14px;
+margin-bottom:30px;
+margin-top:30px;
+margin-left:-10px;
+margin-right:-5px;
+border-top:#E0E0DE 1px solid;
+border-bottom: #E0E0DE 1px solid;
+}
+
+h3{
+
+font: 500 14px/1.2 Arial;
+font-weight:100;
+text-decoration:underline;
+margin-bottom:30px;
+margin-top:30px;
+}
+
+h3.fn,span.fn{
+border-width: 1px;
+border-style: solid;
+border-color: #E6E6E6;
+-moz-border-radius: 7px 7px 7px 7px;
+-webkit-border-radius: 7px 7px 7px 7px;
+border-radius: 7px 7px 7px 7px;
+background-color: #F6F6F6;
+word-spacing: 3px;
+padding: 5px 5px;
+text-decoration:none;
+font-weight:bold;
+max-width:75%;
+font-size:14px;
+margin:0px;
+margin-top:30px;
+
+}
+
+.name{
+color:#1A1A1A;
+}
+.type{
+color:#808080;
+}
+
+
+
+@media print {
+.title {
+color:#0066CB;
+font-family:Arial, Helvetica;
+font-size: 32px;
+font-weight: normal;
+left: 0;
+position: absolute;
+right: 0;
+top: 0;
+}
+}
+
+
+/*
+-----------------
+table styles
+-----------------
+*/
+.table img {
+border:none;
+margin-left:0px;
+-moz-box-shadow:0px 0px 0px #fff;
+-webkit-box-shadow: 0px 0px 0px #fff;
+box-shadow: 0px 0px 0px #fff;
+}
+
+/* table with border alternative colours*/
+
+ table,pre{
+-moz-border-radius: 7px 7px 7px 7px;
+-webkit-border-radius: 7px 7px 7px 7px;
+ border-radius: 7px 7px 7px 7px;
+background-color: #F6F6F6;
+border: 1px solid #E6E6E6;
+border-collapse: separate;
+font-size: 12px;
+line-height: 1.2;
+margin-bottom: 25px;
+margin-left: 15px;
+font-size: 12px;
+line-height: 1.2;
+margin-bottom: 25px;
+margin-left: 15px;
+}
+
+
+table th{
+text-align:left;
+padding-left:20px;
+}
+
+table td {
+padding: 3px 15px 3px 20px;
+border-bottom:#CCC dotted 1px;
+}
+table p { margin:0px;}
+
+table tr.even {
+background-color: white;
+color: #66666E;
+}
+
+table tr.odd {
+background-color: #F6F6F6;
+color: #66666E;
+}
+
+
+table thead {
+text-align:left;
+padding-left:20px;
+background-color:#e1e0e0;
+border-left:none;
+border-right:none;
+}
+
+table thead th {
+padding-top:5px;
+padding-left:10px;
+padding-bottom:5px;
+border-bottom: 2px solid #D1D1D1;
+padding-right:10px;
+}
+
+
+/* table bodless & white*/
+
+.borderless {
+border-radius: 0px 0px 0px 0px;
+background-color: #fff;
+border: 1px solid #fff;
+}
+
+.borderless tr {
+background-color: #FFF;
+color: #66666E;
+}
+
+.borderless td {
+border:none;
+border-bottom:#fff dotted 1px;
+}
+
+/*
+-----------
+List
+-----------
+*/
+
+ul{
+padding-bottom:2px;
+}
+
+li {
+margin-bottom: 10px;
+padding-left: 8px;
+list-style:outside;
+list-style-type:square;
+text-align:left;
+}
+
+
+ol{
+margin:10px;
+padding:0;
+}
+
+ol > li{
+margin-left: 30px;
+padding-left:8px;
+list-style:decimal;
+}
+
+.centerAlign{
+text-align: left;
+}
+
+.cpp{
+display: block;
+margin: 10;
+overflow: hidden;
+overflow-x: hidden;
+overflow-y: hidden;
+padding: 20px 0 20px 0;
+}
+
+.footer{
+margin-top: 50px;
+padding-left:5px;
+margin-bottom: 10px;
+font-size:10px;
+border-top: 1px solid #999;
+padding-top:11px;
+}
+
+.footerNavi{
+width:auto;
+text-align:right;
+margin-top:50px;
+z-index:1;
+}
+
+.memItemLeft{
+padding-right: 3px;
+}
+
+.memItemRight{
+padding: 3px 15px 3px 0;
+}
+
+.qml{
+display: block;
+margin: 10;
+overflow: hidden;
+overflow-x: hidden;
+overflow-y: hidden;
+padding: 20px 0 20px 0;
+}
+
+.qmldefault{
+padding-left: 5px;
+float: right;
+color: red;
+}
+
+.qmlreadonly{
+padding-left: 5px;
+float: right;
+color: #254117;
+}
+
+.rightAlign{
+padding: 3px 5px 3px 10px;
+text-align: right;
+}
+
+/*
+-----------
+Content table
+-----------
+*/
+
+@media print{
+.toc {
+float: right;
+padding-bottom: 10px;
+padding-top: 50px;
+width: 100%;
+background-image:url(../images/bgrContent.png);
+background-position:top;
+background-repeat:no-repeat;
+}
+}
+
+@media screen{
+.toc{
+clear:both;
+float:right;
+vertical-align:top;
+-moz-border-radius: 7px 7px 7px 7px;
+-webkit-border-radius: 7px 7px 7px 7px;
+border-radius: 7px 7px 7px 7px;
+ background:#FFF url(../images/bgrContent.png);
+background-position:top;
+background-repeat:repeat-x;
+border: 1px solid #E6E6E6;
+padding-left:5px;
+padding-bottom:10px;
+height: auto;
+width: 200px;
+text-align:left;
+z-index:2;
+margin-left:20px;
+margin-right:20px;
+margin-top:85px;
+padding-top:0px;
+}
+}
+
+.toc h3{
+text-decoration:none;
+}
+
+.toc h3{font: 500 14px/1.2 Arial;
+font-weight:100;
+padding:0px;
+margin:0px;
+padding-top:5px;
+padding-left:5px;
+}
+
+
+.toc ul{
+width:160px;
+padding-left:10px;
+padding-right:5px;
+padding-top:10px;
+}
+
+.toc ul li{
+margin-left:20px;
+list-style-image:url(../images/blu_dot.png);
+list-style:outside;
+
+}
+
+
+.toc ul li a:link{
+color: #2C418D;
+text-decoration: none;
+}
+
+.toc ul li a:hover{
+color: #869CD1;
+text-decoration:underline;
+
+}
+
+.toc ul li a:visited{
+color: #869CD1;
+font-weight: bold;
+}
+
+.level1{
+border:none;}
+
+.clearfix{
+clear:both;}
+
+/* start index box */
+.indexbox
+{
+width: 100%;
+display:inline-block;
+}
+
+.indexboxcont
+{
+display: block;
+
+}
+
+.indexboxcont .section
+{
+display: inline-block;
+width: 49%;
+*width:42%;
+_width:42%;
+padding:0 2% 0 1%;
+vertical-align:top;
+}
+
+.indexboxcont .indexIcon
+{
+width: 11%;
+*width:18%;
+_width:18%;
+overflow:hidden;
+}
+
+.indexboxcont .section {
+ float: left;
+}
+
+.indexboxcont .section p
+{
+padding-top: 20px;
+padding-bottom: 20px;
+}
+.indexboxcont .sectionlist
+{
+display: inline-block;
+vertical-align:top;
+width: 32.5%;
+padding: 0;
+}
+.indexboxcont .sectionlist ul
+{
+margin-bottom: 20px;
+}
+
+.indexboxcont .sectionlist ul li
+{
+line-height: 12px;
+}
+
+.content .indexboxcont li
+{
+font: normal bold 13px/1 Verdana;
+}
+
+.content .normallist li
+{
+font: normal 13px/1 Verdana;
+}
+
+.indexbox .indexIcon {
+width: 11%;
+}
+
+.indexbox .indexIcon span
+{
+display: block;
+}
+
+.indexboxcont:after
+{
+content: ".";
+display: block;
+height: 0;
+clear: both;
+visibility: hidden;
+}
diff --git a/examples/widgets/doc/src/analogclock.qdoc b/examples/widgets/doc/src/analogclock.qdoc
index e882ccd3c1..68c2ce92b4 100644
--- a/examples/widgets/doc/src/analogclock.qdoc
+++ b/examples/widgets/doc/src/analogclock.qdoc
@@ -28,9 +28,9 @@
/*!
\example widgets/analogclock
\title Analog Clock Example
-
- The Analog Clock example shows how to draw the contents of a custom
- widget.
+ \ingroup examples-widgets
+ \brief The Analog Clock example shows how to draw the contents of a
+ custom widget.
\image analogclock-example.png Screenshot of the Analog Clock example
diff --git a/examples/widgets/doc/src/calculator.qdoc b/examples/widgets/doc/src/calculator.qdoc
index 1e6f9617fe..ee5df0e226 100644
--- a/examples/widgets/doc/src/calculator.qdoc
+++ b/examples/widgets/doc/src/calculator.qdoc
@@ -28,8 +28,8 @@
/*!
\example widgets/calculator
\title Calculator Example
-
- The example shows how to use signals and slots to implement the
+ \ingroup examples-widgets
+ \brief The example shows how to use signals and slots to implement the
functionality of a calculator widget, and how to use QGridLayout
to place child widgets in a grid.
diff --git a/examples/widgets/doc/src/calendarwidget.qdoc b/examples/widgets/doc/src/calendarwidget.qdoc
index d5a54d3c52..027da90df2 100644
--- a/examples/widgets/doc/src/calendarwidget.qdoc
+++ b/examples/widgets/doc/src/calendarwidget.qdoc
@@ -28,8 +28,8 @@
/*!
\title Calendar Widget Example
\example widgets/calendarwidget
-
- The Calendar Widget example shows use of \c QCalendarWidget.
+ \ingroup examples-widgets
+ \brief The Calendar Widget example shows use of \c QCalendarWidget.
\image calendarwidgetexample.png
diff --git a/examples/widgets/doc/src/charactermap.qdoc b/examples/widgets/doc/src/charactermap.qdoc
index 4eb51ca678..8b980bc630 100644
--- a/examples/widgets/doc/src/charactermap.qdoc
+++ b/examples/widgets/doc/src/charactermap.qdoc
@@ -28,8 +28,8 @@
/*!
\example widgets/charactermap
\title Character Map Example
-
-The Character Map example shows how to create a custom widget that can
+\ingroup examples-widgets
+\brief The Character Map example shows how to create a custom widget that can
both display its own content and respond to user input.
The example displays an array of characters which the user can click on
diff --git a/examples/widgets/doc/src/codeeditor.qdoc b/examples/widgets/doc/src/codeeditor.qdoc
index ba7aa8135a..95b75cc82b 100644
--- a/examples/widgets/doc/src/codeeditor.qdoc
+++ b/examples/widgets/doc/src/codeeditor.qdoc
@@ -28,8 +28,8 @@
/*!
\example widgets/codeeditor
\title Code Editor Example
-
- The Code Editor example shows how to create a simple editor that
+ \ingroup examples-widgets
+ \brief The Code Editor example shows how to create a simple editor that
has line numbers and that highlights the current line.
\image codeeditor-example.png
diff --git a/examples/widgets/doc/src/digitalclock.qdoc b/examples/widgets/doc/src/digitalclock.qdoc
index 39bb270981..e628bf80de 100644
--- a/examples/widgets/doc/src/digitalclock.qdoc
+++ b/examples/widgets/doc/src/digitalclock.qdoc
@@ -28,8 +28,8 @@
/*!
\example widgets/digitalclock
\title Digital Clock Example
-
- The Digital Clock example shows how to use QLCDNumber to display a
+ \ingroup examples-widgets
+ \brief The Digital Clock example shows how to use QLCDNumber to display a
number with LCD-like digits.
\image digitalclock-example.png Screenshot of the Digital Clock example
diff --git a/examples/widgets/doc/src/groupbox.qdoc b/examples/widgets/doc/src/groupbox.qdoc
index c9ba733523..cf55672ad8 100644
--- a/examples/widgets/doc/src/groupbox.qdoc
+++ b/examples/widgets/doc/src/groupbox.qdoc
@@ -28,8 +28,8 @@
/*!
\example widgets/groupbox
\title Group Box Example
-
- The Group Box example shows how to use the different kinds of group
+ \ingroup examples-widgets
+ \brief The Group Box example shows how to use the different kinds of group
boxes in Qt.
Group boxes are container widgets that organize buttons into groups,
diff --git a/examples/widgets/doc/src/icons.qdoc b/examples/widgets/doc/src/icons.qdoc
index d39f104bf1..0ba18d4a26 100644
--- a/examples/widgets/doc/src/icons.qdoc
+++ b/examples/widgets/doc/src/icons.qdoc
@@ -28,11 +28,13 @@
/*!
\example widgets/icons
\title Icons Example
+ \ingroup examples-widgets
+ \brief The Icons example shows how QIcon can generate pixmaps reflecting
+ an icon's state, mode and size.
- The Icons example shows how 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.
+ 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.
\image icons-example.png Screenshot of the Icons example
diff --git a/examples/widgets/doc/src/imageviewer.qdoc b/examples/widgets/doc/src/imageviewer.qdoc
index 8b49a7b56d..4bcb5bc2e3 100644
--- a/examples/widgets/doc/src/imageviewer.qdoc
+++ b/examples/widgets/doc/src/imageviewer.qdoc
@@ -28,9 +28,11 @@
/*!
\example widgets/imageviewer
\title Image Viewer Example
+ \ingroup examples-widgets
+ \brief The example shows how to combine QLabel and QScrollArea to
+ display an image.
- The example shows how to combine QLabel and QScrollArea to
- display an image. QLabel is typically used for displaying text,
+ QLabel is typically used for displaying text,
but it can also display an image. QScrollArea provides a
scrolling view around another widget. If the child widget exceeds
the size of the frame, QScrollArea automatically provides scroll
diff --git a/examples/widgets/doc/src/lineedits.qdoc b/examples/widgets/doc/src/lineedits.qdoc
index bc3a8f5c67..42d5005c23 100644
--- a/examples/widgets/doc/src/lineedits.qdoc
+++ b/examples/widgets/doc/src/lineedits.qdoc
@@ -28,10 +28,11 @@
/*!
\example widgets/lineedits
\title Line Edits Example
+ \ingroup examples-widgets
+ \brief The Line Edits example demonstrates the many ways that QLineEdit
+ can be used, and shows the effects of various properties and validators
+ on the input and output supplied by the user.
- The Line Edits example demonstrates the many ways that QLineEdit can be used, and
- shows the effects of various properties and validators on the input and output
- supplied by the user.
\image lineedits-example.png
diff --git a/examples/widgets/doc/src/movie.qdoc b/examples/widgets/doc/src/movie.qdoc
index 7b63425f4f..4990ce6603 100644
--- a/examples/widgets/doc/src/movie.qdoc
+++ b/examples/widgets/doc/src/movie.qdoc
@@ -28,9 +28,11 @@
/*!
\example widgets/movie
\title Movie Example
+ \ingroup examples-widgets
+ \brief The Movie example demonstrates how to use QMovie and QLabel to
+ display animations.
- The Movie example demonstrates how to use QMovie and QLabel to
- display animations. QMovie is mostly useful if one wants to play
+ QMovie is mostly useful if one wants to play
a simple animation without the added complexity of a multimedia
framework to install and deploy.
diff --git a/examples/widgets/doc/src/scribble.qdoc b/examples/widgets/doc/src/scribble.qdoc
index 8798197e56..2d96c6b770 100644
--- a/examples/widgets/doc/src/scribble.qdoc
+++ b/examples/widgets/doc/src/scribble.qdoc
@@ -28,8 +28,8 @@
/*!
\example widgets/scribble
\title Scribble Example
-
- The Scribble example shows how to reimplement some of QWidget's
+ \ingroup examples-widgets
+ \brief The Scribble example shows how to reimplement some of QWidget's
event handlers to receive the events generated for the
application's widgets.
diff --git a/examples/widgets/doc/src/shapedclock.qdoc b/examples/widgets/doc/src/shapedclock.qdoc
index 09dfd100b7..25485569b6 100644
--- a/examples/widgets/doc/src/shapedclock.qdoc
+++ b/examples/widgets/doc/src/shapedclock.qdoc
@@ -28,8 +28,8 @@
/*!
\example widgets/shapedclock
\title Shaped Clock Example
-
- The Shaped Clock example shows how to apply a widget mask to a top-level
+ \ingroup examples-widgets
+ \brief The Shaped Clock example shows how to apply a widget mask to a top-level
widget to produce a shaped window.
\image shapedclock-example.png
diff --git a/examples/widgets/doc/src/sliders.qdoc b/examples/widgets/doc/src/sliders.qdoc
index 6f944ea866..5ed3a9adb3 100644
--- a/examples/widgets/doc/src/sliders.qdoc
+++ b/examples/widgets/doc/src/sliders.qdoc
@@ -28,6 +28,9 @@
/*!
\example widgets/sliders
\title Sliders Example
+ \ingroup examples-widgets
+ \brief The Sliders example shows how to use the different types of sliders
+ available in Qt: QSlider, QScrollBar and QDial.
Qt provides three types of slider-like widgets: QSlider,
QScrollBar and QDial. They all inherit most of their
diff --git a/examples/widgets/doc/src/spinboxes.qdoc b/examples/widgets/doc/src/spinboxes.qdoc
index 460fad746a..4bd450ce4e 100644
--- a/examples/widgets/doc/src/spinboxes.qdoc
+++ b/examples/widgets/doc/src/spinboxes.qdoc
@@ -28,10 +28,10 @@
/*!
\example widgets/spinboxes
\title Spin Boxes Example
-
- The Spin Boxes example shows how to use the many different types of spin boxes
- available in Qt, from a simple QSpinBox widget to more complex editors like
- the QDateTimeEdit widget.
+ \ingroup examples-widgets
+ \brief The Spin Boxes example shows how to use the many different types of
+ spin boxes available in Qt, from a simple QSpinBox widget to more complex
+ editors like the QDateTimeEdit widget.
\image spinboxes-example.png
diff --git a/examples/widgets/doc/src/styles.qdoc b/examples/widgets/doc/src/styles.qdoc
index 773c7a7677..c654a9b958 100644
--- a/examples/widgets/doc/src/styles.qdoc
+++ b/examples/widgets/doc/src/styles.qdoc
@@ -28,8 +28,8 @@
/*!
\example widgets/styles
\title Styles Example
-
- The Styles example illustrates how to create custom widget
+ \ingroup examples-widgets
+ \brief The Styles example illustrates how to create custom widget
drawing styles using Qt, and demonstrates Qt's predefined styles.
\image styles-enabledwood.png Screenshot of the Styles example
diff --git a/examples/widgets/doc/src/stylesheet.qdoc b/examples/widgets/doc/src/stylesheet.qdoc
index 5f44fd0ce8..451bc2778b 100644
--- a/examples/widgets/doc/src/stylesheet.qdoc
+++ b/examples/widgets/doc/src/stylesheet.qdoc
@@ -28,8 +28,8 @@
/*!
\example widgets/stylesheet
\title Style Sheet Example
-
- The Style Sheet Example shows how to use style sheets.
+ \ingroup examples-widgets
+ \brief The Style Sheet Example shows how to use style sheets.
\image stylesheet-pagefold.png Screen Shot of the Pagefold style sheet
*/
diff --git a/examples/widgets/doc/src/tablet.qdoc b/examples/widgets/doc/src/tablet.qdoc
index b8742604ed..41edf8e757 100644
--- a/examples/widgets/doc/src/tablet.qdoc
+++ b/examples/widgets/doc/src/tablet.qdoc
@@ -28,8 +28,8 @@
/*!
\example widgets/tablet
\title Tablet Example
-
- This example shows how to use a Wacom tablet in Qt applications.
+ \ingroup examples-widgets
+ \brief This example shows how to use a Wacom tablet in Qt applications.
\image tabletexample.png
diff --git a/examples/widgets/doc/src/tetrix.qdoc b/examples/widgets/doc/src/tetrix.qdoc
index 769501d48e..0a0690b0b7 100644
--- a/examples/widgets/doc/src/tetrix.qdoc
+++ b/examples/widgets/doc/src/tetrix.qdoc
@@ -28,8 +28,8 @@
/*!
\example widgets/tetrix
\title Tetrix Example
-
- The Tetrix example is a Qt version of the classic Tetrix game.
+ \ingroup examples-widgets
+ \brief The Tetrix example is a Qt version of the classic Tetrix game.
\image tetrix-example.png
diff --git a/examples/widgets/doc/src/tooltips.qdoc b/examples/widgets/doc/src/tooltips.qdoc
index e88f11908e..5e59e24dd5 100644
--- a/examples/widgets/doc/src/tooltips.qdoc
+++ b/examples/widgets/doc/src/tooltips.qdoc
@@ -28,8 +28,8 @@
/*!
\example widgets/tooltips
\title Tool Tips Example
-
- The Tool Tips example shows how to provide static and dynamic tool
+ \ingroup examples-widgets
+ \brief The Tool Tips example shows how to provide static and dynamic tool
tips for an application's widgets.
The simplest and most common way to set a widget's tool tip is by
diff --git a/examples/widgets/doc/src/validators.qdoc b/examples/widgets/doc/src/validators.qdoc
new file mode 100644
index 0000000000..e461b87891
--- /dev/null
+++ b/examples/widgets/doc/src/validators.qdoc
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example widgets/validators
+ \title Validators Example
+ \ingroup examples-widgets
+ \brief The Validators example shows the signal emission behavior of input
+ validators.
+*/
diff --git a/examples/widgets/doc/src/wiggly.qdoc b/examples/widgets/doc/src/wiggly.qdoc
index 29ab759ab0..1840641046 100644
--- a/examples/widgets/doc/src/wiggly.qdoc
+++ b/examples/widgets/doc/src/wiggly.qdoc
@@ -28,8 +28,8 @@
/*!
\example widgets/wiggly
\title Wiggly Example
-
- The Wiggly example shows how to animate a widget using
+ \ingroup examples-widgets
+ \brief The Wiggly example shows how to animate a widget using
QBasicTimer and \l{QObject::timerEvent()}{timerEvent()}. In
addition, the example demonstrates how to use QFontMetrics to
determine the size of text on screen.
diff --git a/examples/widgets/doc/src/windowflags.qdoc b/examples/widgets/doc/src/windowflags.qdoc
index 40a0c6ae8d..3864729b46 100644
--- a/examples/widgets/doc/src/windowflags.qdoc
+++ b/examples/widgets/doc/src/windowflags.qdoc
@@ -28,8 +28,8 @@
/*!
\example widgets/windowflags
\title Window Flags Example
-
- The Window Flags example shows how to use the window flags
+ \ingroup examples-widgets
+ \brief The Window Flags example shows how to use the window flags
available in Qt.
A window flag is either a type or a hint. A type is used to
diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf
index a77738222f..86ce168a8e 100644
--- a/mkspecs/features/default_post.prf
+++ b/mkspecs/features/default_post.prf
@@ -59,7 +59,13 @@ QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST
!contains(QMAKE_EXTRA_TARGETS, docs) {
contains(TEMPLATE, subdirs) {
- prepareRecursiveTarget(docs)
+ prepare_docs {
+ prepareRecursiveTarget(prepare_docs)
+ prepareRecursiveTarget(generate_docs)
+ docs.commands = $(MAKE) -f $(MAKEFILE) prepare_docs && $(MAKE) -f $(MAKEFILE) generate_docs
+ } else {
+ prepareRecursiveTarget(docs)
+ }
} else {
# apps and libs only generate docs if QMAKE_DOCS is set
!isEmpty(QMAKE_DOCS) {
@@ -68,10 +74,19 @@ QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST
for(index, QMAKE_DOCS_INDEX):QDOC_INDEX += -indexdir $$index
!isEmpty(QMAKE_DOCS_OUTPUTDIR):QMAKE_DOCS_OPTIONS += -outputdir $$QMAKE_DOCS_OUTPUTDIR
!isEmpty(QMAKE_DOCS_INSTALLDIR):QMAKE_DOCS_OPTIONS += -installdir $$QMAKE_DOCS_INSTALLDIR
- docs.commands += $$QDOC $$QMAKE_DOCS_OPTIONS $$QDOC_INDEX $$QMAKE_DOCS
+ doc_command = $$QDOC $$QMAKE_DOCS_OPTIONS $$QDOC_INDEX $$QMAKE_DOCS
+
+ prepare_docs {
+ prepare_docs.commands += $$doc_command -prepare -no-link-errors
+ generate_docs.commands += $$doc_command -generate
+ docs.depends += generate_docs
+ } else {
+ docs.commands += $$doc_command
+ }
}
}
QMAKE_EXTRA_TARGETS += docs
+ prepare_docs: QMAKE_EXTRA_TARGETS += prepare_docs generate_docs
}
!contains(QMAKE_EXTRA_TARGETS, install_docs) {
diff --git a/mkspecs/features/qt_build_config.prf b/mkspecs/features/qt_build_config.prf
index 786275dd8a..b386e39235 100644
--- a/mkspecs/features/qt_build_config.prf
+++ b/mkspecs/features/qt_build_config.prf
@@ -25,7 +25,7 @@ mac {
}
}
-CONFIG += create_prl link_prl no_private_qt_headers_warning QTDIR_build
+CONFIG += create_prl link_prl prepare_docs no_private_qt_headers_warning QTDIR_build
# Qt modules get compiled without exceptions enabled by default.
# However, testcases should be still built with exceptions.
diff --git a/src/concurrent/doc/qtconcurrent.qdocconf b/src/concurrent/doc/qtconcurrent.qdocconf
index 47a3e2f497..9d761f451f 100644
--- a/src/concurrent/doc/qtconcurrent.qdocconf
+++ b/src/concurrent/doc/qtconcurrent.qdocconf
@@ -1,33 +1,27 @@
-include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtConcurrent
description = Qt Concurrent Reference Documentation
-url = http://qt-project.org/doc/qt-5.0/qtconcurrent
+url = http://qt-project.org/doc/qtconcurrent
version = 5.0.0
qhp.projects = QtConcurrent
qhp.QtConcurrent.file = qtconcurrent.qhp
qhp.QtConcurrent.namespace = org.qt-project.qtconcurrent.500
-qhp.QtConcurrent.virtualFolder = qdoc
-qhp.QtConcurrent.indexTitle = Qt Concurrent Reference Documentation
+qhp.QtConcurrent.virtualFolder = qtconcurrent
+qhp.QtConcurrent.indexTitle = Qt Concurrent
qhp.QtConcurrent.indexRoot =
qhp.QtConcurrent.filterAttributes = qtconcurrent 5.0.0 qtrefdoc
qhp.QtConcurrent.customFilters.Qt.name = QtConcurrent 5.0.0
qhp.QtConcurrent.customFilters.Qt.filterAttributes = qtconcurrent 5.0.0
-qhp.QtConcurrent.subprojects = classes overviews examples
-qhp.QtConcurrent.subprojects.classes.title = Classes
-qhp.QtConcurrent.subprojects.classes.indexTitle = Qt Concurrent's Classes
+
+qhp.QtConcurrent.subprojects = classes
+qhp.QtConcurrent.subprojects.classes.title = C++ Classes
+qhp.QtConcurrent.subprojects.classes.indexTitle = Qt Concurrent C++ Classes
qhp.QtConcurrent.subprojects.classes.selectors = class fake:headerfile
qhp.QtConcurrent.subprojects.classes.sortPages = true
-qhp.QtConcurrent.subprojects.overviews.title = Overviews
-qhp.QtConcurrent.subprojects.overviews.indexTitle = All Overviews and HOWTOs
-qhp.QtConcurrent.subprojects.overviews.selectors = fake:page,group,module
-qhp.QtConcurrent.subprojects.examples.title = Qt Concurrent Examples
-qhp.QtConcurrent.subprojects.examples.indexTitle = Qt Concurrent Examples
-qhp.QtConcurrent.subprojects.examples.selectors = fake:example
tagfile = ../../../doc/qtconcurrent/qtconcurrent.tags
diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf
index a2cb2f2cfd..6172799487 100644
--- a/src/corelib/doc/qtcore.qdocconf
+++ b/src/corelib/doc/qtcore.qdocconf
@@ -1,37 +1,30 @@
-include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtCore
description = Qt Core Reference Documentation
-url = http://qt-project.org/doc/qt-5.0/qtcore
+url = http://qt-project.org/doc/qtcore
version = 5.0.0
qhp.projects = QtCore
qhp.QtCore.file = qtcore.qhp
qhp.QtCore.namespace = org.qt-project.qtcore.500
-qhp.QtCore.virtualFolder = qdoc
-qhp.QtCore.indexTitle = Qt Core Reference Documentation
+qhp.QtCore.virtualFolder = qtcore
+qhp.QtCore.indexTitle = Qt Core
qhp.QtCore.indexRoot =
qhp.QtCore.filterAttributes = qtcore 5.0.0 qtrefdoc
qhp.QtCore.customFilters.Qt.name = QtCore 5.0.0
qhp.QtCore.customFilters.Qt.filterAttributes = qtcore 5.0.0
-qhp.QtCore.subprojects = classes overviews examples
-qhp.QtCore.subprojects.classes.title = Classes
-qhp.QtCore.subprojects.classes.indexTitle = Qt Core's Classes
+qhp.QtCore.subprojects = classes
+qhp.QtCore.subprojects.classes.title = C++ Classes
+qhp.QtCore.subprojects.classes.indexTitle = Qt Core C++ Classes
qhp.QtCore.subprojects.classes.selectors = class fake:headerfile
qhp.QtCore.subprojects.classes.sortPages = true
-qhp.QtCore.subprojects.overviews.title = Overviews
-qhp.QtCore.subprojects.overviews.indexTitle = All Overviews and HOWTOs
-qhp.QtCore.subprojects.overviews.selectors = fake:page,group,module
-qhp.QtCore.subprojects.examples.title = Qt Core Examples
-qhp.QtCore.subprojects.examples.indexTitle = Qt Core Examples
-qhp.QtCore.subprojects.examples.selectors = fake:example
tagfile = ../../../doc/qtcore/qtcore.tags
-depends += qtwidgets
+depends += qtgui qtwidgets qtnetwork qtdoc
headerdirs += ..
diff --git a/src/corelib/doc/src/filestorage.qdoc b/src/corelib/doc/src/filestorage.qdoc
new file mode 100644
index 0000000000..be548ad0bf
--- /dev/null
+++ b/src/corelib/doc/src/filestorage.qdoc
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page io-functions.html
+\title File and Datastream Functions
+
+The QIODevice class is the base interface class of all I/O devices in
+\l {Qt Core}. QIODevice provides both a common implementation and an
+abstract interface for devices that support reading and writing of blocks
+of data. The device can be a memory buffer, a file, or a datastream.
+
+Some subclasses like QFile have been implemented using a memory buffer for
+intermediate storing of data. This speeds up programs by reducing
+read/write operations. Buffering makes functions like getChar() and putChar()
+fast, as they can operate on the memory buffer instead of directly on the
+device itself.
+
+The QFile class provides functions for reading from and writing to files.
+A QFile may be used by itself or, more conveniently, with a QTextStream or
+QDataStream.
+
+QBuffer allows you to access a QByteArray using the QIODevice interface.
+The QByteArray is treated just as a standard random-accessed file.
+An example:
+
+ QBuffer buffer;
+ char ch;
+
+ buffer.open(QBuffer::ReadWrite);
+ buffer.write("Qt rocks!");
+ buffer.seek(0);
+ buffer.getChar(&ch); // ch == 'Q'
+ buffer.getChar(&ch); // ch == 't'
+ buffer.getChar(&ch); // ch == ' '
+ buffer.getChar(&ch); // ch == 'r'
+
+Call open() to open the buffer. Then call write() or putChar() to write to
+the buffer, and read(), readLine(), readAll(), or getChar() to read from it.
+size() returns the current size of the buffer, and you can seek to arbitrary
+positions in the buffer by calling seek(). When you are done with accessing
+the buffer, call close().
+
+The QDataStream class provides serialization of binary data to a QIODevice.
+A data stream is a binary stream of encoded information which is 100% inde-
+pendent of the host computer's operating system, CPU or byte order. For
+example, a data stream that is written by a PC under Windows can be read
+by a Sun SPARC running Solaris. You can also use a data stream to read/write
+raw unencoded binary data.
+
+For more details on the datatypes that QDataStream can serialize, see
+{Serializing Qt Data Types}.
+
+The QTextStream class provides a convenient interface for reading and
+writing text. QTextStream can operate on a QIODevice, a QByteArray or
+a QString. Using QTextStream's streaming operators, you can conveniently read
+and write words, lines and numbers. It's also common to use QTextStream to
+read console input and write console output.
+
+There are three general ways to use QTextStream when reading text files:
+
+\list
+ \li Chunk by chunk, by calling readLine() or readAll().
+ \li Word by word. QTextStream supports streaming into QStrings, QByteArrays
+ and char* buffers. Words are delimited by space, and leading white space
+ is automatically skipped.
+ \li Character by character, by streaming into QChar or char types. This
+ method is often used for convenient input handling when parsing files,
+ independent of character encoding and end-of-line semantics. To skip
+ white space, call skipWhiteSpace().
+\endlist
+
+QByteArray can be used to store both raw bytes (including \c{\0}) and traditional
+8-bit '\\0'-terminated strings. Using QByteArray is much more convenient
+than using const char *. It always ensures that the data is followed by a '\\0'
+terminator, and uses \l{Implicit Sharing}{implicitly shared classes} (copy-on-write)
+to reduce memory usage and avoid needless copying of data.
+
+In addition to QByteArray, Qt also provides the QString class to store string
+data. For most purposes, QString is the most appropriate class to use. It stores
+16-bit Unicode characters. It is, however, a good idea to use QByteArray when you
+need to store raw binary data, and when memory conservation is critical (for
+example, with Qt for Embedded Linux).
+
+*/
diff --git a/src/dbus/doc/qtdbus.qdocconf b/src/dbus/doc/qtdbus.qdocconf
index f60b8e649e..4fc489f244 100644
--- a/src/dbus/doc/qtdbus.qdocconf
+++ b/src/dbus/doc/qtdbus.qdocconf
@@ -1,33 +1,27 @@
-include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtDBus
description = Qt DBus Reference Documentation
-url = http://qt-project.org/doc/qt-5.0/qtdbus
+url = http://qt-project.org/doc/qtdbus
version = 5.0.0
qhp.projects = QtDBus
qhp.QtDBus.file = qtdbus.qhp
qhp.QtDBus.namespace = org.qt-project.qtdbus.500
-qhp.QtDBus.virtualFolder = qdoc
-qhp.QtDBus.indexTitle = Qt DBus Reference Documentation
+qhp.QtDBus.virtualFolder = qtdbus
+qhp.QtDBus.indexTitle = Qt D-Bus
qhp.QtDBus.indexRoot =
qhp.QtDBus.filterAttributes = qtdbus 5.0.0 qtrefdoc
qhp.QtDBus.customFilters.Qt.name = QtDBus 5.0.0
qhp.QtDBus.customFilters.Qt.filterAttributes = qtdbus 5.0.0
-qhp.QtDBus.subprojects = classes overviews examples
-qhp.QtDBus.subprojects.classes.title = Classes
-qhp.QtDBus.subprojects.classes.indexTitle = Qt DBus' Classes
+
+qhp.QtDBus.subprojects = classes
+qhp.QtDBus.subprojects.classes.title = C++ Classes
+qhp.QtDBus.subprojects.classes.indexTitle = Qt D-Bus C++ Classes
qhp.QtDBus.subprojects.classes.selectors = class fake:headerfile
qhp.QtDBus.subprojects.classes.sortPages = true
-qhp.QtDBus.subprojects.overviews.title = Overviews
-qhp.QtDBus.subprojects.overviews.indexTitle = All Overviews and HOWTOs
-qhp.QtDBus.subprojects.overviews.selectors = fake:page,group,module
-qhp.QtDBus.subprojects.examples.title = Qt DBus Examples
-qhp.QtDBus.subprojects.examples.indexTitle = Qt DBus Examples
-qhp.QtDBus.subprojects.examples.selectors = fake:example
tagfile = ../../../doc/qtdbus/qtdbus.tags
diff --git a/src/gui/doc/images/plaintext-layout.png b/src/gui/doc/images/plaintext-layout.png
new file mode 100644
index 0000000000..9172d7a044
--- /dev/null
+++ b/src/gui/doc/images/plaintext-layout.png
Binary files differ
diff --git a/src/gui/doc/images/richtext-document.png b/src/gui/doc/images/richtext-document.png
new file mode 100644
index 0000000000..4ae5d16b61
--- /dev/null
+++ b/src/gui/doc/images/richtext-document.png
Binary files differ
diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf
index cdf37e29f2..074286b8f9 100644
--- a/src/gui/doc/qtgui.qdocconf
+++ b/src/gui/doc/qtgui.qdocconf
@@ -1,37 +1,39 @@
-include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtGui
description = Qt GUI Reference Documentation
-url = http://qt-project.org/doc/qt-5.0/qtgui
+url = http://qt-project.org/doc/qtgui
version = 5.0.0
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.virtualFolder = qtgui
+qhp.QtGui.indexTitle = Qt GUI
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
+qhp.QtGui.subprojects.classes.title = C++ Classes
+qhp.QtGui.subprojects.classes.indexTitle = Qt GUI C++ 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
tagfile = ../../../doc/qtgui/qtgui.tags
-depends += qtcore
+depends += \
+ qtcore \
+ qtnetwork \
+ qtopengl \
+ qtsvg \
+ qtqml \
+ qtquickt \
+ qtwidgets \
+ qtdoc
headerdirs += ..
diff --git a/src/gui/doc/snippets/code/doc_src_richtext.cpp b/src/gui/doc/snippets/code/doc_src_richtext.cpp
new file mode 100644
index 0000000000..37d417120a
--- /dev/null
+++ b/src/gui/doc/snippets/code/doc_src_richtext.cpp
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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]
+QTextDocument *newDocument = new QTextDocument;
+//! [0]
+
+
+//! [1]
+QTextEdit *editor = new QTextEdit;
+QTextDocument *editorDocument = editor->document();
+//! [1]
+
+
+//! [2]
+QTextEdit *editor = new QTextEdit(parent);
+editor->setHtml(aStringContainingHTMLtext);
+editor->show();
+//! [2]
+
+
+//! [3]
+QTextDocument *document = editor->document();
+//! [3]
+
+
+//! [4]
+QTextCursor cursor = editor->textCursor();
+//! [4]
+
+
+//! [5]
+editor->setTextCursor(cursor);
+//! [5]
+
+
+//! [6]
+textEdit.show();
+
+textCursor.beginEditBlock();
+
+for (int i = 0; i < 1000; ++i) {
+ textCursor.insertBlock();
+ textCursor.insertText(paragraphText.at(i));
+}
+
+textCursor.endEditBlock();
+//! [6]
diff --git a/src/gui/doc/snippets/code/doc_src_richtext.qdoc b/src/gui/doc/snippets/code/doc_src_richtext.qdoc
new file mode 100644
index 0000000000..4cc947be75
--- /dev/null
+++ b/src/gui/doc/snippets/code/doc_src_richtext.qdoc
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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$
+**
+****************************************************************************/
+
+//! [7]
+<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" />
+//! [7]
diff --git a/src/gui/doc/snippets/plaintextlayout/main.cpp b/src/gui/doc/snippets/plaintextlayout/main.cpp
new file mode 100644
index 0000000000..3b10af4028
--- /dev/null
+++ b/src/gui/doc/snippets/plaintextlayout/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 "window.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Window *window = new Window;
+ window->resize(337, 343);
+ window->show();
+ return app.exec();
+}
diff --git a/src/gui/doc/snippets/plaintextlayout/plaintextlayout.pro b/src/gui/doc/snippets/plaintextlayout/plaintextlayout.pro
new file mode 100644
index 0000000000..6283406f25
--- /dev/null
+++ b/src/gui/doc/snippets/plaintextlayout/plaintextlayout.pro
@@ -0,0 +1,3 @@
+HEADERS = window.h
+SOURCES = main.cpp \
+ window.cpp
diff --git a/src/gui/doc/snippets/plaintextlayout/window.cpp b/src/gui/doc/snippets/plaintextlayout/window.cpp
new file mode 100644
index 0000000000..901cfb4880
--- /dev/null
+++ b/src/gui/doc/snippets/plaintextlayout/window.cpp
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 <math.h>
+
+#include "window.h"
+
+Window::Window(QWidget *parent)
+ : QWidget(parent)
+{
+ text = QString("Support for text rendering and layout in Qt 4 has been "
+ "redesigned around a system that allows textual content to "
+ "be represented in a more flexible way than was possible "
+ "with Qt 3. Qt 4 also provides a more convenient "
+ "programming interface for editing documents. These "
+ "improvements are made available through a reimplementation "
+ "of the existing text rendering engine, and the "
+ "introduction of several new classes. "
+ "See the relevant module overview for a detailed discussion "
+ "of this framework. The following sections provide a brief "
+ "overview of the main concepts behind Scribe.");
+
+ setWindowTitle(tr("Plain Text Layout"));
+}
+
+void Window::paintEvent(QPaintEvent *event)
+{
+//! [0]
+ QTextLayout textLayout(text, font);
+ qreal margin = 10;
+ qreal radius = qMin(width()/2.0, height()/2.0) - margin;
+ QFontMetrics fm(font);
+
+ qreal lineHeight = fm.height();
+ qreal y = 0;
+
+ textLayout.beginLayout();
+
+ while (1) {
+ // create a new line
+ QTextLine line = textLayout.createLine();
+ if (!line.isValid())
+ break;
+
+ qreal x1 = qMax(0.0, pow(pow(radius,2)-pow(radius-y,2), 0.5));
+ qreal x2 = qMax(0.0, pow(pow(radius,2)-pow(radius-(y+lineHeight),2), 0.5));
+ qreal x = qMax(x1, x2) + margin;
+ qreal lineWidth = (width() - margin) - x;
+
+ line.setLineWidth(lineWidth);
+ line.setPosition(QPointF(x, margin+y));
+ y += line.height();
+ }
+
+ textLayout.endLayout();
+
+ QPainter painter;
+ painter.begin(this);
+ painter.setRenderHint(QPainter::Antialiasing);
+ painter.fillRect(rect(), Qt::white);
+ painter.setBrush(QBrush(Qt::black));
+ painter.setPen(QPen(Qt::black));
+ textLayout.draw(&painter, QPoint(0,0));
+
+ painter.setBrush(QBrush(QColor("#a6ce39")));
+ painter.setPen(QPen(Qt::black));
+ painter.drawEllipse(QRectF(-radius, margin, 2*radius, 2*radius));
+ painter.end();
+//! [0]
+}
diff --git a/src/gui/doc/snippets/plaintextlayout/window.h b/src/gui/doc/snippets/plaintextlayout/window.h
new file mode 100644
index 0000000000..d6292de412
--- /dev/null
+++ b/src/gui/doc/snippets/plaintextlayout/window.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 <QWidget>
+
+class Window : public QWidget
+{
+ Q_OBJECT
+
+public:
+ Window(QWidget *parent = 0);
+
+protected:
+ void paintEvent(QPaintEvent *event);
+
+private:
+ QFont font;
+ QString text;
+};
+
+#endif
diff --git a/src/gui/doc/snippets/scribe-overview/main.cpp b/src/gui/doc/snippets/scribe-overview/main.cpp
new file mode 100644
index 0000000000..96d1b7ac28
--- /dev/null
+++ b/src/gui/doc/snippets/scribe-overview/main.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 mergeFormat(QTextEdit *edit)
+{
+//! [0]
+ QTextDocument *document = edit->document();
+ QTextCursor cursor(document);
+
+ cursor.movePosition(QTextCursor::Start);
+ cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
+
+ QTextCharFormat format;
+ format.setFontWeight(QFont::Bold);
+
+ cursor.mergeCharFormat(format);
+//! [0]
+}
+
+int main(int argc, char *argv[])
+{
+ QWidget *parent = 0;
+ QString aStringContainingHTMLtext("<h1>Scribe Overview</h1>");
+
+ QApplication app(argc, argv);
+
+//! [1]
+ QTextEdit *editor = new QTextEdit(parent);
+ editor->setHtml(aStringContainingHTMLtext);
+ editor->show();
+//! [1]
+
+ return app.exec();
+}
diff --git a/src/gui/doc/snippets/scribe-overview/scribe-overview.pro b/src/gui/doc/snippets/scribe-overview/scribe-overview.pro
new file mode 100644
index 0000000000..16181f21cf
--- /dev/null
+++ b/src/gui/doc/snippets/scribe-overview/scribe-overview.pro
@@ -0,0 +1 @@
+SOURCES = main.cpp
diff --git a/src/gui/doc/snippets/textblock-formats/main.cpp b/src/gui/doc/snippets/textblock-formats/main.cpp
new file mode 100644
index 0000000000..2f87341629
--- /dev/null
+++ b/src/gui/doc/snippets/textblock-formats/main.cpp
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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);
+
+//! [0]
+ QTextEdit *editor = new QTextEdit();
+ QTextCursor cursor(editor->textCursor());
+//! [0]
+ cursor.movePosition(QTextCursor::Start);
+
+ QTextBlockFormat blockFormat = cursor.blockFormat();
+ blockFormat.setTopMargin(4);
+ blockFormat.setLeftMargin(4);
+ blockFormat.setRightMargin(4);
+ blockFormat.setBottomMargin(4);
+
+ cursor.setBlockFormat(blockFormat);
+ cursor.insertText(tr("This contains plain text inside a "
+ "text block with margins to keep it separate "
+ "from other parts of the document."));
+
+ cursor.insertBlock();
+
+//! [1]
+ QTextBlockFormat backgroundFormat = blockFormat;
+ backgroundFormat.setBackground(QColor("lightGray"));
+
+ cursor.setBlockFormat(backgroundFormat);
+//! [1]
+ cursor.insertText(tr("The background color of a text block can be "
+ "changed to highlight text."));
+
+ cursor.insertBlock();
+
+ QTextBlockFormat rightAlignedFormat = blockFormat;
+ rightAlignedFormat.setAlignment(Qt::AlignRight);
+
+ cursor.setBlockFormat(rightAlignedFormat);
+ cursor.insertText(tr("The alignment of the text within a block is "
+ "controlled by the alignment properties of "
+ "the block itself. This text block is "
+ "right-aligned."));
+
+ cursor.insertBlock();
+
+ QTextBlockFormat paragraphFormat = blockFormat;
+ paragraphFormat.setAlignment(Qt::AlignJustify);
+ paragraphFormat.setTextIndent(32);
+
+ cursor.setBlockFormat(paragraphFormat);
+ cursor.insertText(tr("Text can be formatted so that the first "
+ "line in a paragraph has its own margin. "
+ "This makes the text more readable."));
+
+ cursor.insertBlock();
+
+ QTextBlockFormat reverseFormat = blockFormat;
+ reverseFormat.setAlignment(Qt::AlignJustify);
+ reverseFormat.setTextIndent(32);
+
+ cursor.setBlockFormat(reverseFormat);
+ cursor.insertText(tr("The direction of the text can be reversed. "
+ "This is useful for right-to-left "
+ "languages."));
+
+ editor->setWindowTitle(tr("Text Block Formats"));
+ editor->resize(480, 480);
+ editor->show();
+
+ return app.exec();
+}
diff --git a/src/gui/doc/snippets/textblock-formats/textblock-formats.pro b/src/gui/doc/snippets/textblock-formats/textblock-formats.pro
new file mode 100644
index 0000000000..d664835b09
--- /dev/null
+++ b/src/gui/doc/snippets/textblock-formats/textblock-formats.pro
@@ -0,0 +1,2 @@
+QT += xml
+SOURCES = main.cpp
diff --git a/src/gui/doc/snippets/textblock-fragments/main.cpp b/src/gui/doc/snippets/textblock-fragments/main.cpp
new file mode 100644
index 0000000000..bc9eb837dc
--- /dev/null
+++ b/src/gui/doc/snippets/textblock-fragments/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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/textblock-fragments/mainwindow.cpp b/src/gui/doc/snippets/textblock-fragments/mainwindow.cpp
new file mode 100644
index 0000000000..0771359e6b
--- /dev/null
+++ b/src/gui/doc/snippets/textblock-fragments/mainwindow.cpp
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 *insertMenu = new QMenu(tr("&Insert"));
+
+ QAction *calendarAction = insertMenu->addAction(tr("&Calendar"));
+ calendarAction->setShortcut(tr("Ctrl+I"));
+
+ menuBar()->addMenu(fileMenu);
+ menuBar()->addMenu(insertMenu);
+
+ editor = new QTextEdit(this);
+
+ connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
+ connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
+ connect(calendarAction, SIGNAL(triggered()), this, SLOT(insertCalendar()));
+
+ setCentralWidget(editor);
+ setWindowTitle(tr("Text Document Writer"));
+}
+
+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::insertCalendar()
+{
+ QTextCursor cursor(editor->textCursor());
+ cursor.movePosition(QTextCursor::Start);
+
+ QTextCharFormat format(cursor.charFormat());
+ format.setFontFamily("Courier");
+
+ QTextCharFormat boldFormat = format;
+ boldFormat.setFontWeight(QFont::Bold);
+
+ cursor.insertBlock();
+ cursor.insertText(" ", boldFormat);
+
+ QDate date = QDate::currentDate();
+ int year = date.year(), month = date.month();
+
+ for (int weekDay = 1; weekDay <= 7; ++weekDay) {
+ cursor.insertText(QString("%1 ").arg(QDate::shortDayName(weekDay), 3),
+ boldFormat);
+ }
+
+ cursor.insertBlock();
+ cursor.insertText(" ", format);
+
+ for (int column = 1; column < QDate(year, month, 1).dayOfWeek(); ++column) {
+ cursor.insertText(" ", format);
+ }
+
+ for (int day = 1; day <= date.daysInMonth(); ++day) {
+ int weekDay = QDate(year, month, day).dayOfWeek();
+
+ if (QDate(year, month, day) == date)
+ cursor.insertText(QString("%1 ").arg(day, 3), boldFormat);
+ else
+ cursor.insertText(QString("%1 ").arg(day, 3), format);
+
+ if (weekDay == 7) {
+ cursor.insertBlock();
+ cursor.insertText(" ", format);
+ }
+ }
+}
+
+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 << domDocument->toByteArray(1);
+ return true;
+ }
+ else
+ return false;
+}
diff --git a/src/gui/doc/snippets/textblock-fragments/mainwindow.h b/src/gui/doc/snippets/textblock-fragments/mainwindow.h
new file mode 100644
index 0000000000..cfe504aef2
--- /dev/null
+++ b/src/gui/doc/snippets/textblock-fragments/mainwindow.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 QTextEdit;
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow();
+
+public slots:
+ void insertCalendar();
+ void saveFile();
+
+private:
+ bool writeXml(const QString &fileName);
+
+ QTextEdit *editor;
+};
+
+#endif
diff --git a/src/gui/doc/snippets/textblock-fragments/textblock-fragments.pro b/src/gui/doc/snippets/textblock-fragments/textblock-fragments.pro
new file mode 100644
index 0000000000..83ed78e573
--- /dev/null
+++ b/src/gui/doc/snippets/textblock-fragments/textblock-fragments.pro
@@ -0,0 +1,6 @@
+QT += xml
+HEADERS = mainwindow.h \
+ xmlwriter.h
+SOURCES = main.cpp \
+ mainwindow.cpp \
+ xmlwriter.cpp
diff --git a/src/gui/doc/snippets/textblock-fragments/xmlwriter.h b/src/gui/doc/snippets/textblock-fragments/xmlwriter.h
new file mode 100644
index 0000000000..23bda6b0e7
--- /dev/null
+++ b/src/gui/doc/snippets/textblock-fragments/xmlwriter.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 XMLWRITER_H
+#define XMLWRITER_H
+
+#include <QDomDocument>
+
+class QTextDocument;
+
+class XmlWriter
+{
+public:
+ XmlWriter(QTextDocument *document) : textDocument(document) {}
+ QDomDocument *toXml();
+
+private:
+ void readFragment(const QTextBlock &currentBlock, QDomElement blockElement,
+ QDomDocument *document);
+ void processBlock(const QTextBlock &currentBlock);
+ void processFragment(const QTextFragment &currentFragment);
+
+ QDomDocument *document;
+ QTextDocument *textDocument;
+};
+
+#endif
diff --git a/src/gui/doc/snippets/textdocument-blocks/main.cpp b/src/gui/doc/snippets/textdocument-blocks/main.cpp
new file mode 100644
index 0000000000..bc9eb837dc
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-blocks/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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-blocks/mainwindow.cpp b/src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp
new file mode 100644
index 0000000000..aca440649b
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp
@@ -0,0 +1,156 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 *insertMenu = new QMenu(tr("&Insert"));
+
+ QAction *calendarAction = insertMenu->addAction(tr("&Calendar"));
+ calendarAction->setShortcut(tr("Ctrl+I"));
+
+ menuBar()->addMenu(fileMenu);
+ menuBar()->addMenu(insertMenu);
+
+//! [0]
+ editor = new QTextEdit(this);
+//! [0]
+
+ connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
+ connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
+ connect(calendarAction, SIGNAL(triggered()), this, SLOT(insertCalendar()));
+
+ setCentralWidget(editor);
+ setWindowTitle(tr("Text Document Writer"));
+}
+
+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::insertCalendar()
+{
+//! [1]
+ QTextCursor cursor(editor->textCursor());
+ cursor.movePosition(QTextCursor::Start);
+
+ QTextCharFormat format(cursor.charFormat());
+ format.setFontFamily("Courier");
+
+ QTextCharFormat boldFormat = format;
+ boldFormat.setFontWeight(QFont::Bold);
+
+ cursor.insertBlock();
+ cursor.insertText(" ", boldFormat);
+
+ QDate date = QDate::currentDate();
+ int year = date.year(), month = date.month();
+
+ for (int weekDay = 1; weekDay <= 7; ++weekDay) {
+ cursor.insertText(QString("%1 ").arg(QDate::shortDayName(weekDay), 3),
+ boldFormat);
+ }
+
+ cursor.insertBlock();
+ cursor.insertText(" ", format);
+
+ for (int column = 1; column < QDate(year, month, 1).dayOfWeek(); ++column) {
+ cursor.insertText(" ", format);
+ }
+
+ for (int day = 1; day <= date.daysInMonth(); ++day) {
+//! [1] //! [2]
+ int weekDay = QDate(year, month, day).dayOfWeek();
+
+ if (QDate(year, month, day) == date)
+ cursor.insertText(QString("%1 ").arg(day, 3), boldFormat);
+ else
+ cursor.insertText(QString("%1 ").arg(day, 3), format);
+
+ if (weekDay == 7) {
+ cursor.insertBlock();
+ cursor.insertText(" ", format);
+ }
+//! [2] //! [3]
+ }
+//! [3]
+}
+
+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-blocks/mainwindow.h b/src/gui/doc/snippets/textdocument-blocks/mainwindow.h
new file mode 100644
index 0000000000..cfe504aef2
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-blocks/mainwindow.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 QTextEdit;
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow();
+
+public slots:
+ void insertCalendar();
+ void saveFile();
+
+private:
+ bool writeXml(const QString &fileName);
+
+ QTextEdit *editor;
+};
+
+#endif
diff --git a/src/gui/doc/snippets/textdocument-blocks/textdocument-blocks.pro b/src/gui/doc/snippets/textdocument-blocks/textdocument-blocks.pro
new file mode 100644
index 0000000000..83ed78e573
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-blocks/textdocument-blocks.pro
@@ -0,0 +1,6 @@
+QT += xml
+HEADERS = mainwindow.h \
+ xmlwriter.h
+SOURCES = main.cpp \
+ mainwindow.cpp \
+ xmlwriter.cpp
diff --git a/src/gui/doc/snippets/textdocument-blocks/xmlwriter.cpp b/src/gui/doc/snippets/textdocument-blocks/xmlwriter.cpp
new file mode 100644
index 0000000000..2c691f8195
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-blocks/xmlwriter.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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);
+
+ QTextBlock firstBlock = textDocument->begin();
+ createItems(documentElement, firstBlock);
+
+ return document;
+}
+
+void XmlWriter::createItems(QDomElement &parent, const QTextBlock &block)
+{
+ QTextBlock currentBlock = block;
+
+ while (currentBlock.isValid()) {
+ QDomElement blockElement = document->createElement("block");
+ blockElement.setAttribute("length", currentBlock.length());
+ parent.appendChild(blockElement);
+
+ if (!(currentBlock.text().isNull())) {
+ QDomText textNode = document->createTextNode(currentBlock.text());
+ blockElement.appendChild(textNode);
+ }
+
+ currentBlock = currentBlock.next();
+ }
+}
diff --git a/src/gui/doc/snippets/textdocument-blocks/xmlwriter.h b/src/gui/doc/snippets/textdocument-blocks/xmlwriter.h
new file mode 100644
index 0000000000..e0afaf56a3
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-blocks/xmlwriter.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 XMLWRITER_H
+#define XMLWRITER_H
+
+#include <QDomDocument>
+
+class QTextDocument;
+
+class XmlWriter
+{
+public:
+ XmlWriter(QTextDocument *document) : textDocument(document) {}
+ QDomDocument *toXml();
+
+private:
+ void createItems(QDomElement &parent, const QTextBlock &block);
+
+ QDomDocument *document;
+ QTextDocument *textDocument;
+};
+
+#endif
diff --git a/src/gui/doc/snippets/textdocument-charformats/main.cpp b/src/gui/doc/snippets/textdocument-charformats/main.cpp
new file mode 100644
index 0000000000..cedb09035f
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-charformats/main.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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();
+
+ QTextCursor cursor(editor->textCursor());
+ cursor.movePosition(QTextCursor::Start);
+
+ QTextCharFormat plainFormat(cursor.charFormat());
+
+ QTextCharFormat headingFormat = plainFormat;
+ headingFormat.setFontWeight(QFont::Bold);
+ headingFormat.setFontPointSize(16);
+
+ QTextCharFormat emphasisFormat = plainFormat;
+ emphasisFormat.setFontItalic(true);
+
+ QTextCharFormat qtFormat = plainFormat;
+ qtFormat.setForeground(QColor("#990000"));
+
+ QTextCharFormat underlineFormat = plainFormat;
+ underlineFormat.setFontUnderline(true);
+
+//! [0]
+ cursor.insertText(tr("Character formats"),
+ headingFormat);
+
+ cursor.insertBlock();
+
+ cursor.insertText(tr("Text can be displayed in a variety of "
+ "different character formats. "), plainFormat);
+ cursor.insertText(tr("We can emphasize text by "));
+ cursor.insertText(tr("making it italic"), emphasisFormat);
+//! [0]
+ cursor.insertText(tr(", give it a "), plainFormat);
+ cursor.insertText(tr("different color "), qtFormat);
+ cursor.insertText(tr("to the default text color, "), plainFormat);
+ cursor.insertText(tr("underline it"), underlineFormat);
+ cursor.insertText(tr(", and use many other effects."), plainFormat);
+
+ editor->setWindowTitle(tr("Text Document Character Formats"));
+ editor->resize(320, 480);
+ editor->show();
+ return app.exec();
+}
diff --git a/src/gui/doc/snippets/textdocument-charformats/textdocument-charformats.pro b/src/gui/doc/snippets/textdocument-charformats/textdocument-charformats.pro
new file mode 100644
index 0000000000..16181f21cf
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-charformats/textdocument-charformats.pro
@@ -0,0 +1 @@
+SOURCES = main.cpp
diff --git a/src/gui/doc/snippets/textdocument-cursors/main.cpp b/src/gui/doc/snippets/textdocument-cursors/main.cpp
new file mode 100644
index 0000000000..f6afae52f2
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-cursors/main.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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;
+
+//! [0]
+ QTextDocument *document = editor->document();
+ QTextCursor redCursor(document);
+//! [0] //! [1]
+ QTextCursor blueCursor(document);
+//! [1]
+
+ QTextCharFormat redFormat(redCursor.charFormat());
+ redFormat.setForeground(Qt::red);
+ QTextCharFormat blueFormat(blueCursor.charFormat());
+ blueFormat.setForeground(Qt::blue);
+
+ redCursor.setCharFormat(redFormat);
+ blueCursor.setCharFormat(blueFormat);
+
+ for (int i = 0; i < 20; ++i) {
+ if (i % 2 == 0)
+ redCursor.insertText(tr("%1 ").arg(i), redFormat);
+ if (i % 5 == 0)
+ blueCursor.insertText(tr("%1 ").arg(i), blueFormat);
+ }
+
+ editor->setWindowTitle(tr("Text Document Cursors"));
+ editor->resize(320, 480);
+ editor->show();
+ return app.exec();
+}
diff --git a/src/gui/doc/snippets/textdocument-cursors/textdocument-cursors.pro b/src/gui/doc/snippets/textdocument-cursors/textdocument-cursors.pro
new file mode 100644
index 0000000000..16181f21cf
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-cursors/textdocument-cursors.pro
@@ -0,0 +1 @@
+SOURCES = main.cpp
diff --git a/src/gui/doc/snippets/textdocument-find/main.cpp b/src/gui/doc/snippets/textdocument-find/main.cpp
new file mode 100644
index 0000000000..44c26a8087
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-find/main.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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();
+
+ QTextCursor cursor(editor->textCursor());
+ cursor.movePosition(QTextCursor::Start);
+
+ QTextCharFormat plainFormat(cursor.charFormat());
+ QTextCharFormat colorFormat = plainFormat;
+ colorFormat.setForeground(Qt::red);
+
+ cursor.insertText(tr("Text can be displayed in a variety of "
+ "different character "
+ "formats. "), plainFormat);
+ cursor.insertText(tr("We can emphasize text by making it "));
+ cursor.insertText(tr("italic, give it a different color "));
+ cursor.insertText(tr("to the default text color, underline it, "));
+ cursor.insertText(tr("and use many other effects."));
+
+ QString searchString = tr("text");
+
+ QTextDocument *document = editor->document();
+//! [0]
+ QTextCursor newCursor(document);
+
+ while (!newCursor.isNull() && !newCursor.atEnd()) {
+ newCursor = document->find(searchString, newCursor);
+
+ if (!newCursor.isNull()) {
+ newCursor.movePosition(QTextCursor::WordRight,
+ QTextCursor::KeepAnchor);
+
+ newCursor.mergeCharFormat(colorFormat);
+ }
+//! [0] //! [1]
+ }
+//! [1]
+
+ editor->setWindowTitle(tr("Text Document Find"));
+ editor->resize(320, 480);
+ editor->show();
+ return app.exec();
+}
diff --git a/src/gui/doc/snippets/textdocument-find/textdocument-find.pro b/src/gui/doc/snippets/textdocument-find/textdocument-find.pro
new file mode 100644
index 0000000000..16181f21cf
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-find/textdocument-find.pro
@@ -0,0 +1 @@
+SOURCES = main.cpp
diff --git a/src/gui/doc/snippets/textdocument-frames/main.cpp b/src/gui/doc/snippets/textdocument-frames/main.cpp
new file mode 100644
index 0000000000..3c065cd138
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-frames/main.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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(480, 480);
+ window->show();
+ return app.exec();
+}
+
diff --git a/src/gui/doc/snippets/textdocument-frames/mainwindow.cpp b/src/gui/doc/snippets/textdocument-frames/mainwindow.cpp
new file mode 100644
index 0000000000..4fca7d02cd
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-frames/mainwindow.cpp
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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"));
+
+ menuBar()->addMenu(fileMenu);
+ editor = new QTextEdit();
+
+ QTextCursor cursor(editor->textCursor());
+ cursor.movePosition(QTextCursor::Start);
+
+ QTextFrame *mainFrame = cursor.currentFrame();
+
+ QTextCharFormat plainCharFormat;
+ QTextCharFormat boldCharFormat;
+ boldCharFormat.setFontWeight(QFont::Bold);
+/* main frame
+//! [0]
+ QTextFrame *mainFrame = cursor.currentFrame();
+ cursor.insertText(...);
+//! [0]
+*/
+ cursor.insertText("Text documents are represented by the "
+ "QTextDocument class, rather than by QString objects. "
+ "Each QTextDocument object contains information about "
+ "the document's internal representation, its structure, "
+ "and keeps track of modifications to provide undo/redo "
+ "facilities. This approach allows features such as the "
+ "layout management to be delegated to specialized "
+ "classes, but also provides a focus for the framework.",
+ plainCharFormat);
+
+//! [1]
+ QTextFrameFormat frameFormat;
+ frameFormat.setMargin(32);
+ frameFormat.setPadding(8);
+ frameFormat.setBorder(4);
+//! [1]
+ cursor.insertFrame(frameFormat);
+
+/* insert frame
+//! [2]
+ cursor.insertFrame(frameFormat);
+ cursor.insertText(...);
+//! [2]
+*/
+ cursor.insertText("Documents are either converted from external sources "
+ "or created from scratch using Qt. The creation process "
+ "can done by an editor widget, such as QTextEdit, or by "
+ "explicit calls to the Scribe API.", boldCharFormat);
+
+ cursor = mainFrame->lastCursorPosition();
+/* last cursor
+//! [3]
+ cursor = mainFrame->lastCursorPosition();
+ cursor.insertText(...);
+//! [3]
+*/
+ cursor.insertText("There are two complementary ways to visualize the "
+ "contents of a document: as a linear buffer that is "
+ "used by editors to modify the contents, and as an "
+ "object hierarchy containing structural information "
+ "that is useful to layout engines. In the hierarchical "
+ "model, the objects generally correspond to visual "
+ "elements such as frames, tables, and lists. At a lower "
+ "level, these elements describe properties such as the "
+ "style of text used and its alignment. The linear "
+ "representation of the document is used for editing and "
+ "manipulation of the document's contents.",
+ plainCharFormat);
+
+
+ connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
+ connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
+
+ setCentralWidget(editor);
+ setWindowTitle(tr("Text Document Frames"));
+}
+
+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);
+ }
+}
+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-frames/mainwindow.h b/src/gui/doc/snippets/textdocument-frames/mainwindow.h
new file mode 100644
index 0000000000..4f25902fb2
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-frames/mainwindow.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 QTextEdit;
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow();
+
+public slots:
+ void saveFile();
+
+private:
+ bool writeXml(const QString &fileName);
+
+ QTextEdit *editor;
+};
+
+#endif
diff --git a/src/gui/doc/snippets/textdocument-frames/textdocument-frames.pro b/src/gui/doc/snippets/textdocument-frames/textdocument-frames.pro
new file mode 100644
index 0000000000..91ae50f491
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-frames/textdocument-frames.pro
@@ -0,0 +1,6 @@
+SOURCES = main.cpp \
+ mainwindow.cpp \
+ xmlwriter.cpp
+HEADERS = mainwindow.h \
+ xmlwriter.h
+QT += xml
diff --git a/src/gui/doc/snippets/textdocument-frames/xmlwriter.cpp b/src/gui/doc/snippets/textdocument-frames/xmlwriter.cpp
new file mode 100644
index 0000000000..d4d8d83bda
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-frames/xmlwriter.cpp
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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]
+ QTextFrame *root = textDocument->rootFrame();
+//! [0]
+
+ if (root)
+ processFrame(documentElement, root);
+
+ return document;
+}
+
+void XmlWriter::processBlock(QDomElement &parent, const QTextBlock &block)
+{
+ QDomElement blockElement = document->createElement("block");
+ blockElement.setAttribute("position", block.position());
+ blockElement.setAttribute("length", block.length());
+ parent.appendChild(blockElement);
+
+ QTextBlock::iterator it;
+ for (it = block.begin(); !(it.atEnd()); ++it) {
+ QTextFragment fragment = it.fragment();
+
+ if (fragment.isValid()) {
+ QDomElement fragmentElement = document->createElement("fragment");
+ blockElement.appendChild(fragmentElement);
+
+ fragmentElement.setAttribute("length", fragment.length());
+ QDomText fragmentText = document->createTextNode(fragment.text());
+
+ fragmentElement.appendChild(fragmentText);
+ }
+ }
+}
+
+void XmlWriter::processFrame(QDomElement &parent, QTextFrame *frame)
+{
+ QDomElement frameElement = document->createElement("frame");
+ frameElement.setAttribute("begin", frame->firstPosition());
+ frameElement.setAttribute("end", frame->lastPosition());
+ parent.appendChild(frameElement);
+
+//! [1]
+ QDomElement frameElement = ...
+
+ QTextFrame::iterator it;
+ for (it = frame->begin(); !(it.atEnd()); ++it) {
+
+ QTextFrame *childFrame = it.currentFrame();
+ QTextBlock childBlock = it.currentBlock();
+
+ if (childFrame)
+//! [1] //! [2]
+ processFrame(frameElement, childFrame);
+ else if (childBlock.isValid())
+ processBlock(frameElement, childBlock);
+ }
+//! [2]
+}
diff --git a/src/gui/doc/snippets/textdocument-frames/xmlwriter.h b/src/gui/doc/snippets/textdocument-frames/xmlwriter.h
new file mode 100644
index 0000000000..5953d9346a
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-frames/xmlwriter.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 XMLWRITER_H
+#define XMLWRITER_H
+
+#include <QDomDocument>
+
+class QTextDocument;
+
+class XmlWriter
+{
+public:
+ XmlWriter(QTextDocument *document) : textDocument(document) {}
+ QDomDocument *toXml();
+
+private:
+ void processBlock(QDomElement &parent, const QTextBlock &block);
+ void processFrame(QDomElement &parent, QTextFrame *frame);
+
+ QDomDocument *document;
+//! [0]
+ QTextDocument *textDocument;
+//! [0]
+};
+
+#endif
diff --git a/src/gui/doc/snippets/textdocument-imagedrop/main.cpp b/src/gui/doc/snippets/textdocument-imagedrop/main.cpp
new file mode 100644
index 0000000000..771d9cf2dc
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-imagedrop/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 "textedit.h"
+
+int main(int argc, char * argv[])
+{
+ QApplication app(argc, argv);
+
+ TextEdit *textEdit = new TextEdit;
+ textEdit->show();
+
+ return app.exec();
+} \ No newline at end of file
diff --git a/src/gui/doc/snippets/textdocument-imagedrop/textdocument-imagedrop.pro b/src/gui/doc/snippets/textdocument-imagedrop/textdocument-imagedrop.pro
new file mode 100644
index 0000000000..96d3038a09
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-imagedrop/textdocument-imagedrop.pro
@@ -0,0 +1,2 @@
+SOURCES = textedit.cpp main.cpp
+HEADERS = textedit.h \ No newline at end of file
diff --git a/src/gui/doc/snippets/textdocument-imagedrop/textedit.h b/src/gui/doc/snippets/textdocument-imagedrop/textedit.h
new file mode 100644
index 0000000000..cfa70336d0
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-imagedrop/textedit.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 TEXTEDIT_H
+#define TEXTEDIT_H
+
+#include <QTextEdit>
+
+class TextEdit : public QTextEdit
+{
+ Q_OBJECT
+
+public:
+ TextEdit(QWidget *parent=0);
+ bool canInsertFromMimeData( const QMimeData *source ) const;
+ void insertFromMimeData( const QMimeData *source );
+};
+
+#endif
diff --git a/src/gui/doc/snippets/textdocument-imageformat/images.qrc b/src/gui/doc/snippets/textdocument-imageformat/images.qrc
new file mode 100644
index 0000000000..6473daf34e
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-imageformat/images.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>images/advert.png</file>
+ <file>images/newimage.png</file>
+</qresource>
+</RCC>
diff --git a/src/gui/doc/snippets/textdocument-imageformat/images/advert.png b/src/gui/doc/snippets/textdocument-imageformat/images/advert.png
new file mode 100644
index 0000000000..40e10d5225
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-imageformat/images/advert.png
Binary files differ
diff --git a/src/gui/doc/snippets/textdocument-imageformat/images/newimage.png b/src/gui/doc/snippets/textdocument-imageformat/images/newimage.png
new file mode 100644
index 0000000000..0eec048a77
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-imageformat/images/newimage.png
Binary files differ
diff --git a/src/gui/doc/snippets/textdocument-imageformat/main.cpp b/src/gui/doc/snippets/textdocument-imageformat/main.cpp
new file mode 100644
index 0000000000..923549f49f
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-imageformat/main.cpp
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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);
+
+ QTextImageFormat imageFormat;
+ imageFormat.setName(":/images/advert.png");
+ cursor.insertImage(imageFormat);
+
+ QTextBlock block = cursor.block();
+ QTextFragment fragment;
+ QTextBlock::iterator it;
+
+ for (it = block.begin(); !(it.atEnd()); ++it) {
+ fragment = it.fragment();
+
+ if (fragment.contains(cursor.position()))
+ break;
+ }
+
+//! [0]
+ if (fragment.isValid()) {
+ QTextImageFormat newImageFormat = fragment.charFormat().toImageFormat();
+
+ if (newImageFormat.isValid()) {
+ newImageFormat.setName(":/images/newimage.png");
+ QTextCursor helper = cursor;
+
+ helper.setPosition(fragment.position());
+ helper.setPosition(fragment.position() + fragment.length(),
+ QTextCursor::KeepAnchor);
+ helper.setCharFormat(newImageFormat);
+//! [0] //! [1]
+ }
+//! [1] //! [2]
+ }
+//! [2]
+
+ cursor.insertBlock();
+ cursor.insertText("Code less. Create more.");
+
+ editor->setDocument(document);
+ editor->setWindowTitle(tr("Text Document Image Format"));
+ editor->resize(320, 480);
+ editor->show();
+
+ return app.exec();
+}
diff --git a/src/gui/doc/snippets/textdocument-imageformat/textdocument-imageformat.pro b/src/gui/doc/snippets/textdocument-imageformat/textdocument-imageformat.pro
new file mode 100644
index 0000000000..1c6437050a
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-imageformat/textdocument-imageformat.pro
@@ -0,0 +1,2 @@
+SOURCES = main.cpp
+RESOURCES += images.qrc
diff --git a/src/gui/doc/snippets/textdocument-images/images.qrc b/src/gui/doc/snippets/textdocument-images/images.qrc
new file mode 100644
index 0000000000..09e305e8f2
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-images/images.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>images/advert.png</file>
+</qresource>
+</RCC>
diff --git a/src/gui/doc/snippets/textdocument-images/images/advert.png b/src/gui/doc/snippets/textdocument-images/images/advert.png
new file mode 100644
index 0000000000..40e10d5225
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-images/images/advert.png
Binary files differ
diff --git a/src/gui/doc/snippets/textdocument-images/main.cpp b/src/gui/doc/snippets/textdocument-images/main.cpp
new file mode 100644
index 0000000000..dd9b8e6811
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-images/main.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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;
+
+//! [0]
+ QTextDocument *document = new QTextDocument(editor);
+ QTextCursor cursor(document);
+//! [0]
+
+//! [1]
+ QTextImageFormat imageFormat;
+ imageFormat.setName(":/images/advert.png");
+ cursor.insertImage(imageFormat);
+//! [1]
+
+ cursor.insertBlock();
+ cursor.insertText("Code less. Create more.");
+
+ editor->setDocument(document);
+ editor->setWindowTitle(tr("Text Document Images"));
+ editor->resize(320, 480);
+ editor->show();
+ return app.exec();
+}
diff --git a/src/gui/doc/snippets/textdocument-images/textdocument-images.pro b/src/gui/doc/snippets/textdocument-images/textdocument-images.pro
new file mode 100644
index 0000000000..1c6437050a
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-images/textdocument-images.pro
@@ -0,0 +1,2 @@
+SOURCES = main.cpp
+RESOURCES += images.qrc
diff --git a/src/gui/doc/snippets/textdocument-listitems/main.cpp b/src/gui/doc/snippets/textdocument-listitems/main.cpp
new file mode 100644
index 0000000000..bc9eb837dc
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-listitems/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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-listitems/mainwindow.cpp b/src/gui/doc/snippets/textdocument-listitems/mainwindow.cpp
new file mode 100644
index 0000000000..1089a0468f
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-listitems/mainwindow.cpp
@@ -0,0 +1,197 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 *actionsMenu = new QMenu(tr("&Actions"));
+ actionsMenu->addAction(tr("&Highlight List Items"),
+ this, SLOT(highlightListItems()));
+ actionsMenu->addAction(tr("&Show Current List"), this, SLOT(showList()));
+
+ 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);
+ menuBar()->addMenu(actionsMenu);
+
+ editor = new QTextEdit(this);
+ document = new QTextDocument(this);
+ editor->setDocument(document);
+
+ setCentralWidget(editor);
+ setWindowTitle(tr("Text Document List Items"));
+}
+
+void MainWindow::highlightListItems()
+{
+ QTextCursor cursor = editor->textCursor();
+ QTextList *list = cursor.currentList();
+
+ if (!list)
+ return;
+
+ cursor.beginEditBlock();
+//! [0]
+ for (int index = 0; index < list->count(); ++index) {
+ QTextBlock listItem = list->item(index);
+//! [0]
+ QTextBlockFormat newBlockFormat = listItem.blockFormat();
+ newBlockFormat.setBackground(Qt::lightGray);
+ QTextCursor itemCursor = cursor;
+ itemCursor.setPosition(listItem.position());
+ //itemCursor.movePosition(QTextCursor::StartOfBlock);
+ itemCursor.movePosition(QTextCursor::EndOfBlock,
+ QTextCursor::KeepAnchor);
+ itemCursor.setBlockFormat(newBlockFormat);
+ /*
+//! [1]
+ processListItem(listItem);
+//! [1]
+ */
+//! [2]
+ }
+//! [2]
+ cursor.endEditBlock();
+}
+
+void MainWindow::showList()
+{
+ QTextCursor cursor = editor->textCursor();
+ QTextFrame *frame = cursor.currentFrame();
+
+ if (!frame)
+ return;
+
+ QTreeWidget *treeWidget = new QTreeWidget;
+ treeWidget->setColumnCount(1);
+ QStringList headerLabels;
+ headerLabels << tr("Lists");
+ treeWidget->setHeaderLabels(headerLabels);
+
+ QTreeWidgetItem *parentItem = 0;
+ QTreeWidgetItem *item;
+ QTreeWidgetItem *lastItem = 0;
+ parentItems.clear();
+ previousItems.clear();
+
+//! [3]
+ QTextFrame::iterator it;
+ for (it = frame->begin(); !(it.atEnd()); ++it) {
+
+ QTextBlock block = it.currentBlock();
+
+ if (block.isValid()) {
+
+ QTextList *list = block.textList();
+
+ if (list) {
+ int index = list->itemNumber(block);
+//! [3]
+ if (index == 0) {
+ parentItems.append(parentItem);
+ previousItems.append(lastItem);
+ listStructures.append(list);
+ parentItem = lastItem;
+ lastItem = 0;
+
+ if (parentItem != 0)
+ item = new QTreeWidgetItem(parentItem, lastItem);
+ else
+ item = new QTreeWidgetItem(treeWidget, lastItem);
+
+ } else {
+
+ while (parentItem != 0 && listStructures.last() != list) {
+ listStructures.pop_back();
+ parentItem = parentItems.takeLast();
+ lastItem = previousItems.takeLast();
+ }
+ if (parentItem != 0)
+ item = new QTreeWidgetItem(parentItem, lastItem);
+ else
+ item = new QTreeWidgetItem(treeWidget, lastItem);
+ }
+ item->setText(0, block.text());
+ lastItem = item;
+ /*
+//! [4]
+ processListItem(list, index);
+//! [4]
+ */
+//! [5]
+ }
+//! [5] //! [6]
+ }
+//! [6] //! [7]
+ }
+//! [7]
+
+ treeWidget->setWindowTitle(tr("List Contents"));
+ treeWidget->show();
+}
+
+void MainWindow::insertList()
+{
+ QTextCursor cursor = editor->textCursor();
+ cursor.beginEditBlock();
+
+ QTextList *list = cursor.currentList();
+ QTextListFormat listFormat;
+ if (list)
+ listFormat = list->format();
+
+ listFormat.setStyle(QTextListFormat::ListDisc);
+ listFormat.setIndent(listFormat.indent() + 1);
+ cursor.insertList(listFormat);
+
+ cursor.endEditBlock();
+}
diff --git a/src/gui/doc/snippets/textdocument-listitems/mainwindow.h b/src/gui/doc/snippets/textdocument-listitems/mainwindow.h
new file mode 100644
index 0000000000..b71cfea998
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-listitems/mainwindow.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 <QList>
+#include <QMainWindow>
+#include <QString>
+
+class QAction;
+class QTextDocument;
+class QTextEdit;
+class QTextList;
+class QTreeWidgetItem;
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow();
+
+public slots:
+ void insertList();
+ void highlightListItems();
+ void showList();
+
+private:
+ QString currentFile;
+ QTextEdit *editor;
+ QTextDocument *document;
+ QList<QTextList*> listStructures;
+ QList<QTreeWidgetItem*> previousItems;
+ QList<QTreeWidgetItem*> parentItems;
+};
+
+#endif
diff --git a/src/gui/doc/snippets/textdocument-listitems/textdocument-listitems.pro b/src/gui/doc/snippets/textdocument-listitems/textdocument-listitems.pro
new file mode 100644
index 0000000000..5da8d6e1a1
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-listitems/textdocument-listitems.pro
@@ -0,0 +1,3 @@
+HEADERS = mainwindow.h
+SOURCES = main.cpp \
+ mainwindow.cpp
diff --git a/src/gui/doc/snippets/textdocument-printing/main.cpp b/src/gui/doc/snippets/textdocument-printing/main.cpp
new file mode 100644
index 0000000000..bc9eb837dc
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-printing/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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-printing/mainwindow.cpp b/src/gui/doc/snippets/textdocument-printing/mainwindow.cpp
new file mode 100644
index 0000000000..6abe90a3d3
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-printing/mainwindow.cpp
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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("&Open..."), this, SLOT(openFile()),
+ QKeySequence(tr("Ctrl+O", "File|Open")));
+
+ printAction = fileMenu->addAction(tr("&Print..."), this, SLOT(printFile()));
+ printAction->setEnabled(false);
+
+ pdfPrintAction = fileMenu->addAction(tr("Print as P&DF..."), this, SLOT(printPdf()));
+ pdfPrintAction->setEnabled(false);
+
+ fileMenu->addAction(tr("E&xit"), this, SLOT(close()),
+ QKeySequence(tr("Ctrl+Q", "File|Exit")));
+
+ menuBar()->addMenu(fileMenu);
+
+ editor = new QTextEdit(this);
+ document = new QTextDocument(this);
+ editor->setDocument(document);
+
+ connect(editor, SIGNAL(selectionChanged()), this, SLOT(updateMenus()));
+
+ setCentralWidget(editor);
+ setWindowTitle(tr("Text Document Writer"));
+}
+
+void MainWindow::openFile()
+{
+ QString fileName = QFileDialog::getOpenFileName(this,
+ tr("Open file"), currentFile, "HTML files (*.html);;Text files (*.txt)");
+
+ if (!fileName.isEmpty()) {
+ QFileInfo info(fileName);
+ if (info.completeSuffix() == "html") {
+ QFile file(fileName);
+
+ if (file.open(QIODevice::ReadOnly)) {
+ editor->setHtml(file.readAll());
+ file.close();
+ currentFile = fileName;
+ }
+ } else if (info.completeSuffix() == "txt") {
+ QFile file(fileName);
+
+ if (file.open(QIODevice::ReadOnly)) {
+ editor->setPlainText(file.readAll());
+ file.close();
+ currentFile = fileName;
+ }
+ }
+ printAction->setEnabled(true);
+ pdfPrintAction->setEnabled(true);
+ }
+}
+
+void MainWindow::printFile()
+{
+//! [0]
+ QTextDocument *document = editor->document();
+ QPrinter printer;
+
+ QPrintDialog *dlg = new QPrintDialog(&printer, this);
+ if (dlg->exec() != QDialog::Accepted)
+ return;
+
+ document->print(&printer);
+//! [0]
+}
+
+void MainWindow::printPdf()
+{
+ QPrinter printer(QPrinter::HighResolution);
+ printer.setOutputFormat(QPrinter::PdfFormat);
+
+ QPrintDialog *printDialog = new QPrintDialog(&printer, this);
+ if (printDialog->exec() == QDialog::Accepted)
+ editor->document()->print(&printer);
+}
diff --git a/src/gui/doc/snippets/textdocument-printing/mainwindow.h b/src/gui/doc/snippets/textdocument-printing/mainwindow.h
new file mode 100644
index 0000000000..cce30a9642
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-printing/mainwindow.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QHash>
+#include <QMainWindow>
+#include <QTextDocumentFragment>
+
+class QAction;
+class QTextDocument;
+class QTextEdit;
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow();
+
+public slots:
+ void openFile();
+ void printFile();
+ void printPdf();
+
+private:
+ QAction *printAction;
+ QAction *pdfPrintAction;
+ QString currentFile;
+ QTextEdit *editor;
+ QTextDocument *document;
+};
+
+#endif
diff --git a/src/gui/doc/snippets/textdocument-printing/textdocument-printing.pro b/src/gui/doc/snippets/textdocument-printing/textdocument-printing.pro
new file mode 100644
index 0000000000..5da8d6e1a1
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-printing/textdocument-printing.pro
@@ -0,0 +1,3 @@
+HEADERS = mainwindow.h
+SOURCES = main.cpp \
+ mainwindow.cpp
diff --git a/src/gui/doc/snippets/textdocument-selections/main.cpp b/src/gui/doc/snippets/textdocument-selections/main.cpp
new file mode 100644
index 0000000000..bc9eb837dc
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-selections/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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-selections/mainwindow.cpp b/src/gui/doc/snippets/textdocument-selections/mainwindow.cpp
new file mode 100644
index 0000000000..a776a921a4
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-selections/mainwindow.cpp
@@ -0,0 +1,203 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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("&Open..."), this, SLOT(openFile()),
+ QKeySequence(tr("Ctrl+O", "File|Open")));
+
+ QAction *quitAction = fileMenu->addAction(tr("E&xit"), this, SLOT(close()));
+ quitAction->setShortcut(tr("Ctrl+Q"));
+
+ QMenu *editMenu = new QMenu(tr("&Edit"));
+
+ cutAction = editMenu->addAction(tr("Cu&t"), this, SLOT(cutSelection()));
+ cutAction->setShortcut(tr("Ctrl+X"));
+ cutAction->setEnabled(false);
+
+ copyAction = editMenu->addAction(tr("&Copy"), this, SLOT(copySelection()));
+ copyAction->setShortcut(tr("Ctrl+C"));
+ copyAction->setEnabled(false);
+
+ pasteAction = editMenu->addAction(tr("&Paste"), this, SLOT(pasteSelection()));
+ pasteAction->setShortcut(tr("Ctrl+V"));
+ pasteAction->setEnabled(false);
+
+ 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()));
+
+ menuBar()->addMenu(fileMenu);
+ menuBar()->addMenu(editMenu);
+ menuBar()->addMenu(selectMenu);
+
+ editor = new QTextEdit(this);
+ document = new QTextDocument(this);
+ editor->setDocument(document);
+
+ connect(editor, SIGNAL(selectionChanged()), this, SLOT(updateMenus()));
+
+ setCentralWidget(editor);
+ setWindowTitle(tr("Text Document Writer"));
+}
+
+void MainWindow::openFile()
+{
+ QString fileName = QFileDialog::getOpenFileName(this,
+ tr("Open file"), currentFile, "HTML files (*.html);;Text files (*.txt)");
+
+ if (!fileName.isEmpty()) {
+ QFileInfo info(fileName);
+ if (info.completeSuffix() == "html") {
+ QFile file(fileName);
+
+ if (file.open(QFile::ReadOnly)) {
+ editor->setHtml(QString(file.readAll()));
+ file.close();
+ currentFile = fileName;
+ }
+ } else if (info.completeSuffix() == "txt") {
+ QFile file(fileName);
+
+ if (file.open(QFile::ReadOnly)) {
+ editor->setPlainText(file.readAll());
+ file.close();
+ currentFile = fileName;
+ }
+ }
+ }
+}
+
+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();
+
+//! [0]
+ cursor.beginEditBlock();
+//! [1]
+ cursor.movePosition(QTextCursor::StartOfWord);
+ cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
+//! [1]
+ cursor.endEditBlock();
+//! [0]
+
+ 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::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-selections/mainwindow.h b/src/gui/doc/snippets/textdocument-selections/mainwindow.h
new file mode 100644
index 0000000000..9e512f9b44
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-selections/mainwindow.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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>
+#include <QTextDocumentFragment>
+
+class QAction;
+class QTextDocument;
+class QTextEdit;
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow();
+
+public slots:
+ void cutSelection();
+ void copySelection();
+ void openFile();
+ void pasteSelection();
+ void selectWord();
+ void selectLine();
+ void selectBlock();
+ void selectFrame();
+ void updateMenus();
+
+private:
+ QAction *cutAction;
+ QAction *copyAction;
+ QAction *pasteAction;
+ QString currentFile;
+ QTextEdit *editor;
+ QTextDocument *document;
+ QTextDocumentFragment selection;
+};
+
+#endif
diff --git a/src/gui/doc/snippets/textdocument-selections/textdocument-selections.pro b/src/gui/doc/snippets/textdocument-selections/textdocument-selections.pro
new file mode 100644
index 0000000000..253c452723
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-selections/textdocument-selections.pro
@@ -0,0 +1,4 @@
+QT += xml
+HEADERS = mainwindow.h
+SOURCES = main.cpp \
+ mainwindow.cpp
diff --git a/src/gui/doc/snippets/textdocument-tables/main.cpp b/src/gui/doc/snippets/textdocument-tables/main.cpp
new file mode 100644
index 0000000000..e3ba2ba467
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-tables/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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(480, 480);
+ window->show();
+ return app.exec();
+}
diff --git a/src/gui/doc/snippets/textdocument-tables/mainwindow.h b/src/gui/doc/snippets/textdocument-tables/mainwindow.h
new file mode 100644
index 0000000000..6a9329323b
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-tables/mainwindow.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 QTextEdit;
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow();
+
+public slots:
+ void saveFile();
+ void showTable();
+
+private:
+ bool writeXml(const QString &fileName);
+
+ QTextEdit *editor;
+};
+
+#endif
diff --git a/src/gui/doc/snippets/textdocument-tables/textdocument-tables.pro b/src/gui/doc/snippets/textdocument-tables/textdocument-tables.pro
new file mode 100644
index 0000000000..91ae50f491
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-tables/textdocument-tables.pro
@@ -0,0 +1,6 @@
+SOURCES = main.cpp \
+ mainwindow.cpp \
+ xmlwriter.cpp
+HEADERS = mainwindow.h \
+ xmlwriter.h
+QT += xml
diff --git a/src/gui/doc/snippets/textdocument-tables/xmlwriter.cpp b/src/gui/doc/snippets/textdocument-tables/xmlwriter.cpp
new file mode 100644
index 0000000000..73d0f17ff1
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-tables/xmlwriter.cpp
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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);
+
+ QTextFrame *root = textDocument->rootFrame();
+
+ if (root)
+ processFrame(documentElement, root);
+
+ return document;
+}
+
+void XmlWriter::processBlock(QDomElement &parent, const QTextBlock &block)
+{
+ QDomElement blockElement = document->createElement("block");
+ blockElement.setAttribute("position", block.position());
+ blockElement.setAttribute("length", block.length());
+ parent.appendChild(blockElement);
+
+ QTextBlock::iterator it;
+ for (it = block.begin(); !(it.atEnd()); ++it) {
+ QTextFragment fragment = it.fragment();
+
+ if (fragment.isValid()) {
+ QDomElement fragmentElement = document->createElement("fragment");
+ blockElement.appendChild(fragmentElement);
+
+ fragmentElement.setAttribute("length", fragment.length());
+ QDomText fragmentText = document->createTextNode(fragment.text());
+
+ fragmentElement.appendChild(fragmentText);
+ }
+ }
+}
+
+void XmlWriter::processFrame(QDomElement &parent, QTextFrame *frame)
+{
+ QDomElement frameElement = document->createElement("frame");
+ frameElement.setAttribute("begin", frame->firstPosition());
+ frameElement.setAttribute("end", frame->lastPosition());
+ parent.appendChild(frameElement);
+
+//! [0]
+ QDomElement frameElement = ...
+
+ QTextFrame::iterator it;
+ for (it = frame->begin(); !(it.atEnd()); ++it) {
+
+ QTextFrame *childFrame = it.currentFrame();
+ QTextBlock childBlock = it.currentBlock();
+
+ if (childFrame) {
+ QTextTable *childTable = qobject_cast<QTextTable*>(childFrame);
+
+ if (childTable)
+ processTable(frameElement, childTable);
+ else
+ processFrame(frameElement, childFrame);
+
+ } else if (childBlock.isValid())
+//! [0] //! [1]
+ processBlock(frameElement, childBlock);
+ }
+//! [1]
+}
+
+void XmlWriter::processTable(QDomElement &parent, QTextTable *table)
+{
+ QDomElement element = document->createElement("table");
+
+ for (int row = 0; row < table->rows(); ++row) {
+ for (int column = 0; column < table->columns(); ++column) {
+ QTextTableCell cell = table->cellAt(row, column);
+ processTableCell(element, cell);
+ }
+ }
+ parent.appendChild(element);
+}
+
+void XmlWriter::processTableCell(QDomElement &parent, const QTextTableCell &cell)
+{
+ QDomElement element = document->createElement("cell");
+ element.setAttribute("row", cell.row());
+ element.setAttribute("column", cell.column());
+
+ QTextFrame::iterator it;
+ for (it = cell.begin(); !(it.atEnd()); ++it) {
+
+ QTextFrame *childFrame = it.currentFrame();
+ QTextBlock childBlock = it.currentBlock();
+
+ if (childFrame)
+ processFrame(element, childFrame);
+ else if (childBlock.isValid())
+ processBlock(element, childBlock);
+ }
+ parent.appendChild(element);
+}
diff --git a/src/gui/doc/snippets/textdocument-tables/xmlwriter.h b/src/gui/doc/snippets/textdocument-tables/xmlwriter.h
new file mode 100644
index 0000000000..33bd83d92b
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-tables/xmlwriter.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $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 Digia Plc 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 XMLWRITER_H
+#define XMLWRITER_H
+
+#include <QDomDocument>
+
+class QTextDocument;
+
+class XmlWriter
+{
+public:
+ XmlWriter(QTextDocument *document) : textDocument(document) {}
+ QDomDocument *toXml();
+
+private:
+ void processBlock(QDomElement &parent, const QTextBlock &block);
+ void processFrame(QDomElement &parent, QTextFrame *frame);
+ void processTable(QDomElement &parent, QTextTable *table);
+ void processTableCell(QDomElement &parent, const QTextTableCell &cell);
+
+ QDomDocument *document;
+ QTextDocument *textDocument;
+};
+
+#endif
diff --git a/src/gui/doc/src/richtext.qdoc b/src/gui/doc/src/richtext.qdoc
new file mode 100644
index 0000000000..b4ba4ba6c4
--- /dev/null
+++ b/src/gui/doc/src/richtext.qdoc
@@ -0,0 +1,1214 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \group richtext-processing
+ \title Rich Text Processing APIs
+*/
+
+/*!
+ \page richtext.html
+ \title Rich Text Processing
+ \brief An overview of Qt's rich text processing, editing and display features.
+
+ \ingroup frameworks-technologies
+ \ingroup qt-basic-concepts
+ \ingroup best-practices
+
+ \nextpage Rich Text Document Structure
+
+ The Scribe framework provides a set of classes for reading and manipulating
+ structured rich text documents. Unlike previous rich text support in Qt, the
+ new classes are centered around the QTextDocument class rather than raw
+ textual information. This enables the developer to create and modify
+ structured rich text documents without having to prepare content in an
+ intermediate markup format.
+
+ The information within a document can be accessed via two complementary
+ interfaces: A cursor-based interface is used for editing, and a read-only
+ hierarchical interface provides a high level overview of the document
+ structure. The main advantage of the cursor-based interface is that the
+ text can be edited using operations that mimic a user's interaction with
+ an editor, without losing the underlying structure of the document. The
+ read-only hierarchical interface is most useful when performing operations
+ such as searching and document export.
+
+ This document is divided up into chapters for convenient reference:
+
+ \list
+ \li \l{Rich Text Document Structure} outlines
+ the different kinds of elements in a QTextDocument, and describes how
+ they are arranged in a document structure.
+ \li \l{The QTextCursor Interface} explains how rich
+ text documents can be edited using the cursor-based interface.
+ \li \l{Document Layouts} briefly explains the role of document layouts.
+ \li \l{Common Rich Text Editing Tasks} examines some
+ common tasks that involve reading or manipulating rich text documents.
+ \li \l{Advanced Rich Text Processing} examines advanced rich text editing tasks.
+ \li \l{Supported HTML Subset} lists the HTML tags supported by QTextDocument.
+ \endlist
+
+ \section1 Rich Text Processing APIs
+
+ Qt provides an extensive collection of classes for parsing, rendering
+ manipulating and editing rich text.
+
+ \annotatedlist richtext-processing
+*/
+
+/*!
+ \page richtext-structure.html
+ \contentspage richtext.html Contents
+ \previouspage Rich Text Processing
+ \nextpage The QTextCursor Interface
+
+ \title Rich Text Document Structure
+
+ \tableofcontents
+
+ Text documents are represented by the QTextDocument class, which
+ contains information about the document's internal representation, its
+ structure, and keeps track of modifications to provide undo/redo
+ facilities.
+
+ The structured representation of a text document presents its contents as
+ a hierarchy of text blocks, frames, tables, and other objects. These provide
+ a logical structure to the document and describe how their contents will be
+ displayed. Generally, frames and tables are used to group other
+ structures while text blocks contain the actual textual information.
+
+ New elements are created and inserted into the document programmatically
+ \l{richtext-cursor.html}{with a QTextCursor} or by using an editor
+ widget, such as QTextEdit. Elements can be given a particular format when
+ they are created; otherwise they take the cursor's current format for the
+ element.
+
+ \table
+ \row
+ \li \inlineimage richtext-document.png
+ \li \b{Basic structure}
+
+ The "top level" of a document might be populated in the way shown.
+ Each document always contains a root frame, and this always contains
+ at least one text block.
+
+ For documents with some textual content, the root
+ frame usually contains a sequence of blocks and other elements.
+
+ Sequences of frames and tables are always separated by text blocks in a
+ document, even if the text blocks contain no information. This ensures that
+ new elements can always be inserted between existing structures.
+ \endtable
+
+ In this chapter, we look at each of the structural elements
+ used in a rich text document, outline their features and uses, and show
+ how to examine their contents. Document editing is described in
+ \l{richtext-cursor.html}{The QTextCursor Interface}.
+
+ \section1 Rich Text Documents
+
+ QTextDocument objects contain all the information required to construct
+ rich text documents.
+ Text documents can be accessed in two complementary ways: as a linear
+ buffer for editors to use, and as an object hierarchy that is useful to
+ layout engines.
+ In the hierarchical document model, objects generally correspond to
+ visual elements such as frames, tables, and lists. At a lower level,
+ these elements describe properties such as the text style and alignment.
+ The linear representation of the document is used for editing and
+ manipulation of the document's contents.
+
+ Although QTextEdit makes it easy to display and edit rich text, documents
+ can also be used independently of any editor widget, for example:
+
+ \snippet code/doc_src_richtext.cpp 0
+
+ Alternatively, they can be extracted from an existing editor:
+
+ \snippet code/doc_src_richtext.cpp 1
+
+ This flexibility enables applications to handle multiple rich text
+ documents without the overhead of multiple editor widgets, or requiring
+ documents to be stored in some intermediate format.
+
+ An empty document contains a root frame which itself contains a single
+ empty text block. Frames provide logical separation between parts of the document, but
+ also have properties that determine how they will appear when rendered.
+ A table is a specialized type of frame that consists of a number of
+ cells, arranged into rows and columns, each of which can contain
+ further structure and text. Tables provide management and layout
+ features that allow flexible configurations of cells to be created.
+
+ Text blocks contain text fragments, each of which specifies text and
+ character format information. Textual properties are defined both at
+ the character level and at the block level. At the character level,
+ properties such as font family, text color, and font weight can be
+ specified. The block level properties control the higher level
+ appearance and behavior of the text, such as the direction of text
+ flow, alignment, and background color.
+
+ The document structure is not manipulated directly. Editing is
+ performed through a cursor-based interface.
+ The \l{richtext-cursor.html}{text cursor interface}
+ automatically inserts new document elements into the root frame, and
+ ensures that it is padded with empty blocks where necessary.
+
+ We obtain the root frame in the following manner:
+
+ \snippet textdocument-frames/xmlwriter.h 0
+ \snippet textdocument-frames/xmlwriter.cpp 0
+
+ When navigating the document structure, it is useful to begin at the
+ root frame because it provides access to the entire document structure.
+
+
+ \section1 Document Elements
+
+ Rich text documents usually consist of common elements such as paragraphs,
+ frames, tables, and lists. These are represented in a QTextDocument
+ by the QTextBlock, QTextFrame, QTextTable, and QTextList classes.
+ Unlike the other elements in a document, images are represented by
+ specially formatted text fragments. This enables them to be placed
+ formatted inline with the surrounding text.
+
+ The basic structural building blocks in documents are QTextBlock and
+ QTextFrame. Blocks themselves contain fragments of rich text
+ (QTextFragment), but these do not directly influence the high level
+ structure of a document.
+
+ Elements which can group together other document elements are typically
+ subclasses of QTextObject, and fall into two categories: Elements that
+ group together text blocks are subclasses of QTextBlockGroup, and those
+ that group together frames and other elements are subclasses of QTextFrame.
+
+ \section2 Text Blocks
+
+ Text blocks are provided by the QTextBlock class.
+
+ Text blocks group together fragments of text with different character formats,
+ and are used to represent paragraphs in the document. Each block
+ typically contains a number of text fragments with different styles.
+ Fragments are created when text is inserted into the document, and more
+ of them are added when the document is edited. The document splits, merges,
+ and removes fragments to efficiently represent the different styles
+ of text in the block.
+
+ The fragments within a given block can be examined by using a
+ QTextBlock::iterator to traverse the block's internal structure:
+
+ \snippet textblock-fragments/xmlwriter.cpp 3
+ \snippet textblock-fragments/xmlwriter.cpp 5
+ \snippet textblock-fragments/xmlwriter.cpp 6
+
+ Blocks are also used to represent list items. As a result, blocks can
+ define their own character formats which contain information about
+ block-level decoration, such as the type of bullet points used for
+ list items. The formatting for the block itself is described by the
+ QTextBlockFormat class, and describes properties such as text alignment,
+ indentation, and background color.
+
+ Although a given document may contain complex structures, once we have a
+ reference to a valid block in the document, we can navigate between each
+ of the text blocks in the order in which they were written:
+
+ \snippet textblock-fragments/xmlwriter.cpp 0
+ \snippet textblock-fragments/xmlwriter.cpp 1
+ \snippet textblock-fragments/xmlwriter.cpp 2
+
+ This method is useful for when you want to extract just the rich text from a
+ document because it ignores frames, tables, and other types of structure.
+
+ QTextBlock provides comparison operators that make it easier to manipulate
+ blocks: \l{QTextBlock::operator==()}{operator==()} and
+ \l{QTextBlock::operator!=()}{operator!=()} are used to test whether two
+ blocks are the same, and \l{QTextBlock::operator<()}{operator<()} is used
+ to determine which one occurs first in a document.
+
+ \section2 Frames
+
+ Frames are provided by the QTextFrame class.
+
+ Text frames group together blocks of text and child frames, creating
+ document structures that are larger than paragraphs. The format of a frame
+ specifies how it is rendered and positioned on the page. Frames are
+ either inserted into the text flow, or they float on the left or right
+ hand side of the page.
+ Each document contains a root frame that contains all the other document
+ elements. As a result, all frames except the root frame have a parent
+ frame.
+
+ Since text blocks are used to separate other document elements, each
+ frame will always contain at least one text block, and zero or more
+ child frames. We can inspect the contents of a frame by using a
+ QTextFrame::iterator to traverse the frame's child elements:
+
+ \snippet textdocument-frames/xmlwriter.cpp 1
+ \snippet textdocument-frames/xmlwriter.cpp 2
+
+ Note that the iterator selects both frames and blocks, so it is necessary
+ to check which it is referring to. This allows us to navigate the document
+ structure on a frame-by-frame basis yet still access text blocks if
+ required. Both the QTextBlock::iterator and QTextFrame::iterator classes
+ can be used in complementary ways to extract the required structure from
+ a document.
+
+ \section2 Tables
+
+ Tables are provided by the QTextTable class.
+
+ Tables are collections of cells that are arranged in rows and columns.
+ Each table cell is a document element with its own character format, but it
+ can also contain other elements, such as frames and text blocks. Table cells
+ are automatically created when the table is constructed, or when extra rows
+ or columns are added. They can also be moved between tables.
+
+ QTextTable is a subclass of QTextFrame, so tables are treated like frames
+ in the document structure. For each frame that we encounter in the
+ document, we can test whether it represents a table, and deal with it in a
+ different way:
+
+ \snippet textdocument-tables/xmlwriter.cpp 0
+ \snippet textdocument-tables/xmlwriter.cpp 1
+
+ The cells within an existing table can be examined by iterating through
+ the rows and columns.
+
+ \snippet textdocument-tables/mainwindow.cpp 9
+ \snippet textdocument-tables/mainwindow.cpp 10
+ \snippet textdocument-tables/mainwindow.cpp 11
+ \snippet textdocument-tables/mainwindow.cpp 12
+
+
+ \section2 Lists
+
+ Lists are provided by the QTextList class.
+
+ Lists are sequences of text blocks that are formatted in the usual way, but
+ which also provide the standard list decorations such as bullet points and
+ enumerated items. Lists can be nested, and will be indented if the list's
+ format specifies a non-zero indentation.
+
+ We can refer to each list item by its index in the list:
+
+ \snippet textdocument-listitems/mainwindow.cpp 0
+ \snippet textdocument-listitems/mainwindow.cpp 1
+ \snippet textdocument-listitems/mainwindow.cpp 2
+
+ Since QTextList is a subclass of QTextBlockGroup, it does not group the
+ list items as child elements, but instead provides various functions for
+ managing them. This means that any text block we find when traversing a
+ document may actually be a list item. We can ensure that list items are
+ correctly identified by using the following code:
+
+ \snippet textdocument-listitems/mainwindow.cpp 3
+ \snippet textdocument-listitems/mainwindow.cpp 4
+ \snippet textdocument-listitems/mainwindow.cpp 5
+ \snippet textdocument-listitems/mainwindow.cpp 6
+ \snippet textdocument-listitems/mainwindow.cpp 7
+
+
+ \section2 Images
+
+ Images in QTextDocument are represented by text fragments that reference
+ external images via the resource mechanism. Images are created using the
+ cursor interface, and can be modified later by changing the character
+ format of the image's text fragment:
+
+ \snippet textdocument-imageformat/main.cpp 0
+ \snippet textdocument-imageformat/main.cpp 1
+ \snippet textdocument-imageformat/main.cpp 2
+
+ The fragment that represents the image can be found by iterating over
+ the fragments in the text block that contains the image.
+*/
+
+/*!
+ \page richtext-cursor.html
+ \contentspage richtext.html Contents
+ \previouspage Rich Text Document Structure
+ \nextpage Document Layouts
+
+ \title The QTextCursor Interface
+
+ \tableofcontents
+
+ Documents can be edited via the interface provided by the QTextCursor
+ class; cursors are either created using a constructor or obtained from
+ an editor widget. The cursor is used to perform editing operations that
+ correspond exactly to those the user is able to make themselves in an
+ editor. As a result, information about the document structure is also
+ available through the cursor, and this allows the structure to be
+ modified. The use of a cursor-oriented interface for editing makes the
+ process of writing a custom editor simpler for developers, since the
+ editing operations can be easily visualized.
+
+ The QTextCursor class also maintains information about any text it
+ has selected in the document, again following a model that is
+ conceptually similar to the actions made by the user to select text
+ in an editor.
+
+ Rich text documents can have multiple cursors
+ associated with them, and each of these contains information about their
+ position in the document and any selections that they may hold. This
+ cursor-based paradigm makes common operations, such as cutting and pasting
+ text, simple to implement programmatically, yet it also allows more complex
+ editing operations to be performed on the document.
+
+ This chapter describes most of the common editing operations that you
+ will need to perform using a cursor, from basic insertion of text and
+ document elements to more complex manipulation of document structures.
+
+ \section1 Cursor-Based Editing
+
+ At the simplest level, text documents are made up of a string of characters,
+ marked up in some way to represent the block structure of the text within the
+ document. QTextCursor provides a cursor-based interface that allows the
+ contents of a QTextDocument to be manipulated at the character level. Since
+ the elements (blocks, frames, tables, etc.) are also encoded in the character
+ stream, the document structure can itself be changed by the cursor.
+
+ The cursor keeps track of its location within its parent document, and can
+ report information about the surrounding structure, such as the enclosing
+ text block, frame, table, or list. The formats of the enclosing structures
+ can also be directly obtained through the cursor.
+
+ \section2 Using a Cursor
+
+ The main use of a cursor is to insert or modify text within a block.
+ We can use a text editor's cursor to do this:
+
+ \snippet textblock-formats/main.cpp 0
+
+ Alternatively, we can obtain a cursor directly from a document:
+
+ \snippet textdocument-images/main.cpp 0
+
+ The cursor is positioned at the start of the document so that we can write
+ into the first (empty) block in the document.
+
+ \section2 Grouping Cursor Operations
+
+ A series of editing operations can be packaged together so that they can
+ be replayed, or undone together in a single action. This is achieved by
+ using the \c beginEditBlock() and \c endEditBlock() functions in the
+ following way, as in the following example where we select the word that
+ contains the cursor:
+
+ \snippet textdocument-selections/mainwindow.cpp 0
+
+ If editing operations are not grouped, the document automatically records
+ the individual operations so that they can be undone later. Grouping
+ operations into larger packages can make editing more efficient both for
+ the user and for the application, but care has to be taken not to group too
+ many operations together as the user may want find-grained control over the
+ undo process.
+
+ \section2 Multiple Cursors
+
+ Multiple cursors can be used to simultaneously edit the same document,
+ although only one will be visible to the user in a QTextEdit widget.
+ The QTextDocument ensures that each cursor writes text correctly and
+ does not interfere with any of the others.
+
+ \omit
+ \snippet textdocument-cursors/main.cpp 0
+ \snippet textdocument-cursors/main.cpp 1
+ \endomit
+
+ \section1 Inserting Document Elements
+
+ QTextCursor provides several functions that can be used to change the
+ structure of a rich text document. Generally, these functions allow
+ document elements to be created with relevant formatting information,
+ and they are inserted into the document at the cursor's position.
+
+ The first group of functions insert block-level elements, and update the
+ cursor position, but they do not return the element that was inserted:
+
+ \list
+ \li \l{QTextCursor::insertBlock()}{insertBlock()} inserts a new text block
+ (paragraph) into a document at the cursor's position, and moves the
+ cursor to the start of the new block.
+ \li \l{QTextCursor::insertFragment()}{insertFragment()} inserts an existing
+ text fragment into a document at the cursor's position.
+ \li \l{QTextCursor::insertImage()}{insertImage()} inserts an image into a
+ document at the cursor's position.
+ \li \l{QTextCursor::insertText()}{insertText()} inserts text into the
+ document at the cursor's position.
+ \endlist
+
+ You can examine the contents of the element that was inserted through the
+ cursor interface.
+
+ The second group of functions insert elements that provide structure to
+ the document, and return the structure that was inserted:
+
+ \list
+ \li \l{QTextCursor::insertFrame()}{insertFrame()} inserts a frame into the
+ document \e after the cursor's current block, and moves the cursor to
+ the start of the empty block in the new frame.
+ \li \l{QTextCursor::insertList()}{insertList()} inserts a list into the
+ document at the cursor's position, and moves the cursor to the start
+ of the first item in the list.
+ \li \l{QTextCursor::insertTable()}{insertTable()} inserts a table into
+ the document \e after the cursor's current block, and moves the cursor
+ to the start of the block following the table.
+ \endlist
+
+ These elements either contain or group together other elements in the
+ document.
+
+ \section2 Text and Text Fragments
+
+ Text can be inserted into the current block in the current character
+ format, or in a custom format that is specified with the text:
+
+ \snippet textdocument-charformats/main.cpp 0
+
+ Once the character format has been used with a cursor, that format becomes
+ the default format for any text inserted with that cursor until another
+ character format is specified.
+
+ If a cursor is used to insert text without specifying a character format,
+ the text will be given the character format used at that position in the
+ document.
+
+ \section2 Blocks
+
+ Text blocks are inserted into the document with the
+ \l{QTextCursor::insertBlock()}{insertBlock()} function.
+
+ \snippet textblock-formats/main.cpp 1
+
+ The cursor is positioned at the start of the new block.
+
+ \section2 Frames
+
+ Frames are inserted into a document using the cursor, and will be placed
+ within the cursor's current frame \e after the current block.
+ The following code shows how a frame can be inserted between two text
+ blocks in a document's root frame. We begin by finding the cursor's
+ current frame:
+
+ \snippet textdocument-frames/mainwindow.cpp 0
+
+ We insert some text in this frame then set up a frame format for the
+ child frame:
+
+ \snippet textdocument-frames/mainwindow.cpp 1
+
+ The frame format will give the frame an external margin of 32 pixels,
+ internal padding of 8 pixels, and a border that is 4 pixels wide.
+ See the QTextFrameFormat documentation for more information about
+ frame formats.
+
+ The frame is inserted into the document after the preceding text:
+
+ \snippet textdocument-frames/mainwindow.cpp 2
+
+ We add some text to the document immediately after we insert the frame.
+ Since the text cursor is positioned \e{inside the frame} when it is inserted
+ into the document, this text will also be inserted inside the frame.
+
+ Finally, we position the cursor outside the frame by taking the last
+ available cursor position inside the frame we recorded earlier:
+
+ \snippet textdocument-frames/mainwindow.cpp 3
+
+ The text that we add last is inserted after the child frame in the
+ document. Since each frame is padded with text blocks, this ensures that
+ more elements can always be inserted with a cursor.
+
+ \section2 Tables
+
+ Tables are inserted into the document using the cursor, and will be
+ placed within the cursor's current frame \e after the current block:
+
+ \snippet textdocument-tables/mainwindow.cpp 0
+ \snippet textdocument-tables/mainwindow.cpp 3
+
+ Tables can be created with a specific format that defines the overall
+ properties of the table, such as its alignment, background color, and
+ the cell spacing used. It can also determine the constraints on each
+ column, allowing each of them to have a fixed width, or resize according
+ to the available space.
+
+ \snippet textdocument-tables/mainwindow.cpp 2
+
+ The columns in the table created above will each take up a certain
+ percentage of the available width. Note that the table format is
+ optional; if you insert a table without a format, some sensible
+ default values will be used for the table's properties.
+
+ Since cells can contain other document elements, they too can be
+ formatted and styled as necessary.
+
+ Text can be added to the table by navigating to each cell with the cursor
+ and inserting text.
+
+ \snippet textdocument-tables/mainwindow.cpp 4
+
+ We can create a simple timetable by following this approach:
+
+ \snippet textdocument-tables/mainwindow.cpp 5
+ \snippet textdocument-tables/mainwindow.cpp 6
+ \snippet textdocument-tables/mainwindow.cpp 7
+ \snippet textdocument-tables/mainwindow.cpp 8
+
+ \section2 Lists
+
+ Lists of block elements can be automatically created and inserted into the
+ document at the current cursor position. Each list that is created in this
+ way requires a list format to be specified:
+
+ \snippet textdocument-lists/mainwindow.cpp 0
+
+ The above code first checks whether the cursor is within an existing list
+ and, if so, gives the list format for the new list a suitable level of
+ indentation. This allows nested lists to be created with increasing
+ levels of indentation. A more sophisticated implementation would also use
+ different kinds of symbol for the bullet points in each level of the list.
+
+ \section2 Images
+
+ Inline images are added to documents through the cursor in the usual manner.
+ Unlike many other elements, all of the image properties are specified by the
+ image's format. This means that a QTextImageFormat object has to be
+ created before an image can be inserted:
+
+ \snippet textdocument-images/main.cpp 1
+
+ The image name refers to an entry in the application's resource file.
+ The method used to derive this name is described in
+ \l{resources.html}{The Qt Resource System}.
+
+ \section1 Examples
+
+ Rich text is stored in text documents that can either be created by
+ importing HTML from an external source, or generated using a QTextCursor.
+
+ \section2 Manipulating Rich Text
+
+ The easiest way to use a rich text document is through
+ the QTextEdit class, providing an editable view onto a document. The code
+ below imports HTML into a document, and displays the document using a
+ text edit widget.
+
+ \snippet scribe-overview/main.cpp 1
+
+ You can retrieve the document from the text edit using the
+ document() function. The document can then be edited programmatically
+ using the QTextCursor class. This class is modeled after a screen
+ cursor, and editing operations follow the same semantics. The following
+ code changes the first line of the document to a bold font, leaving all
+ other font properties untouched. The editor will be automatically
+ updated to reflect the changes made to the underlying document data.
+
+ \snippet scribe-overview/main.cpp 0
+
+ Note that the cursor was moved from the start of the first line to the
+ end, but that it retained an anchor at the start of the line. This
+ demonstrates the cursor-based selection facilities of the
+ QTextCursor class.
+
+ \section2 Generating a Calendar
+
+ Rich text can be generated very quickly using the cursor-based
+ approach. The following example shows a simple calendar in a
+ QTextEdit widget with bold headers for the days of the week:
+
+ \snippet textdocument-blocks/mainwindow.cpp 0
+ \codeline
+ \snippet textdocument-blocks/mainwindow.cpp 1
+ \snippet textdocument-blocks/mainwindow.cpp 2
+ \snippet textdocument-blocks/mainwindow.cpp 3
+
+ The above example demonstrates how simple it is to quickly generate new
+ rich text documents using a minimum amount of code. Although we have
+ generated a crude fixed-pitch calendar to avoid quoting too much code,
+ Scribe provides much more sophisticated layout and formatting features.
+*/
+
+/*!
+ \page richtext-layouts.html
+ \contentspage richtext.html Contents
+ \previouspage The QTextCursor Interface
+ \nextpage Common Rich Text Editing Tasks
+
+ \title Document Layouts
+
+ \tableofcontents
+
+ The layout of a document is only relevant when it is to be displayed on
+ a device, or when some information is requested that requires a visual
+ representation of the document. Until this occurs, the document does
+ not need to be formatted and prepared for a device.
+
+ \section1 Overview
+
+ Each document's layout is managed by a subclass of the
+ QAbstractTextDocumentLayout class. This class provides a common
+ interface for layout and rendering engines. The default rendering
+ behavior is currently implemented in a private class. This approach
+ makes it possible to create custom layouts, and provides the
+ mechanism used when preparing pages for printing or exporting to
+ Portable Document Format (PDF) files.
+
+ \section1 Example - Shaped Text Layout
+
+ Sometimes it is important to be able to format plain text within an
+ irregularly-shaped region, perhaps when rendering a custom widget, for
+ example. Scribe provides generic features, such as those provided by
+ the QTextLayout class, to help developers perform word-wrapping and
+ layout tasks without the need to create a document first.
+
+ \image plaintext-layout.png
+
+ Formatting and drawing a paragraph of plain text is straightforward.
+ The example below will lay out a paragraph of text, using a single
+ font, around the right hand edge of a circle.
+
+ \snippet plaintextlayout/window.cpp 0
+
+ We create a text layout, specifying the text string we want to display
+ and the font to use. We ensure that the text we supplied is formatted
+ correctly by obtaining text lines from the text format, and wrapping
+ the remaining text using the available space. The lines are positioned
+ as we move down the page.
+
+ The formatted text can be drawn onto a paint device; in the above code,
+ the text is drawn directly onto a widget.
+ */
+
+ /*!
+ \page richtext-common-tasks.html
+ \contentspage richtext.html Contents
+ \previouspage Document Layouts
+ \nextpage Advanced Rich Text Processing
+
+ \title Common Rich Text Editing Tasks
+
+ \tableofcontents
+
+ There are a number of tasks that are often performed by developers
+ when editing and processing text documents using Qt. These include the use
+ of display widgets such as QTextBrowser and QTextEdit, creation of
+ documents with QTextDocument, editing using a QTextCursor, and
+ exporting the document structure.
+ This document outlines some of the more common ways of using the rich
+ text classes to perform these tasks, showing convenient patterns that can
+ be reused in your own applications.
+
+ \section1 Using QTextEdit
+
+ A text editor widget can be constructed and used to display HTML in the
+ following way:
+
+ \snippet code/doc_src_richtext.cpp 2
+
+ By default, the text editor contains a document with a root frame, inside
+ which is an empty text block. This document can be obtained so that it can
+ be modified directly by the application:
+
+ \snippet code/doc_src_richtext.cpp 3
+
+ The text editor's cursor may also be used to edit a document:
+
+ \snippet code/doc_src_richtext.cpp 4
+
+ Although a document can be edited using many cursors at once, a QTextEdit
+ only displays a single cursor at a time. Therefore, if we want to update the
+ editor to display a particular cursor or its selection, we need to set the
+ editor's cursor after we have modified the document:
+
+ \snippet code/doc_src_richtext.cpp 5
+
+ \section1 Selecting Text
+
+ Text is selected by moving the cursor using operations that are similar to
+ those performed by a user in a text editor. To select text between two
+ points in the document, we need to position the cursor at the first point
+ then move it using a special mode (\l{QTextCursor::MoveMode}) with a
+ move operation (\l{QTextCursor::MoveOperation}).
+ When we select the text, we leave the selection anchor at the old cursor
+ position just as the user might do by holding down the Shift key when
+ selecting text:
+
+ \snippet textdocument-selections/mainwindow.cpp 1
+
+ In the above code, a whole word is selected using this method. QTextCursor
+ provides a number of common move operations for selecting individual
+ characters, words, lines, and whole blocks.
+
+ \section1 Finding Text
+
+ QTextDocument provides a cursor-based interface for searching, making
+ it easy to find and modify text in the style of a text editor. The following
+ code finds all the instances of a particular word in a document, and changes
+ the color of each:
+
+ \snippet textdocument-find/main.cpp 0
+ \snippet textdocument-find/main.cpp 1
+
+ Note that the cursor does not have to be moved after each search and replace
+ operation; it is always positioned at the end of the word that was just
+ replaced.
+
+ \section1 Printing Documents
+
+ QTextEdit is designed for the display of large rich text documents that are
+ read on screen, rendering them in the same way as a web browser. As a result,
+ it does not automatically break the contents of the document into page-sized
+ pieces that are suitable for printing.
+
+ QTextDocument provides a \l{QTextDocument::print()}{print()} function to
+ allow documents to be printed using the QPrinter class. The following code
+ shows how to prepare a document in a QTextEdit for printing with a QPrinter:
+
+ \snippet textdocument-printing/mainwindow.cpp 0
+
+ The document is obtained from the text editor, and a QPrinter is constructed
+ then configured using a QPrintDialog. If the user accepts the printer's
+ configuration then the document is formatted and printed using the
+ \l{QTextDocument::print()}{print()} function.
+*/
+
+/*!
+ \page richtext-advanced-processing.html
+ \contentspage richtext.html Contents
+ \previouspage Common Rich Text Editing Tasks
+ \nextpage Supported HTML Subset
+
+ \title Advanced Rich Text Processing
+
+ \section1 Handling Large Files
+
+ Qt does not limit the size of files that are used for text
+ processing. In most cases, this will not present a problem. For
+ especially large files, however, you might experience that your
+ application will become unresponsive or that you will run out of
+ memory. The size of the files you can load depends on your
+ hardware and on Qt's and your own application's implementation.
+
+ If you are faced with this problem, we recommend that you address the
+ following issues:
+
+ \list
+ \li You should consider breaking up large paragraphs into smaller
+ ones as Qt handles small paragraphs better. You could also
+ insert line breaks at regular intervals, which will look the
+ same as one large paragraph in a QTextEdit.
+ \li You can reduce the amount of blocks in a QTextDocument with
+ \l{QTextDocument::}{maximumBlockCount()}. The document is only
+ as large as the number of blocks as far as QTextEdit is concerned.
+ \li When adding text to a text edit, it is an advantage to add it
+ in an edit block (see example below). The result is that the
+ text edit does not need to build the entire document structure at once.
+ \endlist
+
+ We give an example of the latter technique from the list. We assume that
+ the text edit is visible.
+
+ \snippet code/doc_src_richtext.cpp 6
+
+ \omit
+ Ideas for other sections:
+
+ * Hiding QTextBlock elements.
+ * Changing the word wrapping mode in QTextEdit. Custom word wrapping?
+ \endomit
+*/
+
+/*!
+ \page richtext-html-subset.html
+ \title Supported HTML Subset
+ \brief Describes the support for HTML markup in text widgets.
+
+ \contentspage richtext.html Contents
+ \previouspage Common Rich Text Editing Tasks
+
+ Qt's text widgets are able to display rich text, specified using a subset of \l{HTML 4}
+ markup. Widgets that use QTextDocument, such as QLabel and QTextEdit, are able to display
+ rich text specified in this way.
+
+ \tableofcontents
+
+ \section1 Using HTML Markup in Text Widgets
+
+ Widgets automatically detect HTML markup and display rich text accordingly. For example,
+ setting a label's \l{QLabel::}{text} property with the string \c{"<b>Hello</b> <i>Qt!</i>"}
+ will result in the label displaying text like this: \b{Hello} \e{Qt!}
+
+ When HTML markup is used for text, Qt follows the rules defined by the \l{HTML 4}
+ specification. This includes default properties for text layout, such as the
+ direction of the text flow (left-to-right) which can be changed by applying the
+ \l{#Block Attributes}{\c dir} attribute to blocks of text.
+
+ \section1 Supported Tags
+
+ The following table lists the HTML tags supported by Qt's
+ \l{Rich Text Processing}{rich text} engine:
+
+ \table
+ \header \li Tag
+ \li Description
+ \li Comment
+ \row \li \c a
+ \li Anchor or link
+ \li Supports the \c href and \c name attributes.
+ \row \li \c address
+ \li Address
+ \li
+ \row \li \c b
+ \li Bold
+ \li
+ \row \li \c big
+ \li Larger font
+ \li
+ \row \li \c blockquote
+ \li Indented paragraph
+ \li
+ \row \li \c body
+ \li Document body
+ \li Supports the \c bgcolor attribute, which
+ can be a Qt \l{QColor::setNamedColor()}{color name}
+ or a \c #RRGGBB color specification.
+ \row \li \c br
+ \li Line break
+ \li
+ \row \li \c center
+ \li Centered paragraph
+ \li
+ \row \li \c cite
+ \li Inline citation
+ \li Same as \c i.
+ \row \li \c code
+ \li Code
+ \li Same as \c tt.
+ \row \li \c dd
+ \li Definition data
+ \li
+ \row \li \c dfn
+ \li Definition
+ \li Same as \c i.
+ \row \li \c div
+ \li Document division
+ \li Supports the standard \l{block attributes}.
+ \row \li \c dl
+ \li Definition list
+ \li Supports the standard \l{block attributes}.
+ \row \li \c dt
+ \li Definition term
+ \li Supports the standard \l{block attributes}.
+ \row \li \c em
+ \li Emphasized
+ \li Same as \c i.
+ \row \li \c font
+ \li Font size, family, and/or color
+ \li Supports the following attributes:
+ \c size, \c face, and \c color (Qt
+ \l{QColor::setNamedColor()}{color names} or
+ \c #RRGGBB).
+ \row \li \c h1
+ \li Level 1 heading
+ \li Supports the standard \l{block attributes}.
+ \row \li \c h2
+ \li Level 2 heading
+ \li Supports the standard \l{block attributes}.
+ \row \li \c h3
+ \li Level 3 heading
+ \li Supports the standard \l{block attributes}.
+ \row \li \c h4
+ \li Level 4 heading
+ \li Supports the standard \l{block attributes}.
+ \row \li \c h5
+ \li Level 5 heading
+ \li Supports the standard \l{block attributes}.
+ \row \li \c h6
+ \li Level 6 heading
+ \li Supports the standard \l{block attributes}.
+ \row \li \c head
+ \li Document header
+ \li
+ \row \li \c hr
+ \li Horizontal line
+ \li Supports the \c width attribute, which can
+ be specified as an absolute or relative (\c %) value.
+ \row \li \c html
+ \li HTML document
+ \li
+ \row \li \c i
+ \li Italic
+ \li
+ \row \li \c img
+ \li Image
+ \li Supports the \c src, \c source
+ (for Qt 3 compatibility), \c width, and \c height
+ attributes.
+ \row \li \c kbd
+ \li User-entered text
+ \li
+ \row \li \c meta
+ \li Meta-information
+ \li If a text encoding is specified using the \c{meta} tag,
+ it is picked up by Qt::codecForHtml().
+ Likewise, if an encoding is specified to
+ QTextDocument::toHtml(), the encoding is stored using
+ a \c meta tag, for example:
+
+ \snippet code/doc_src_richtext.qdoc 7
+
+ \row \li \c li
+ \li List item
+ \li
+ \row \li \c nobr
+ \li Non-breakable text
+ \li
+ \row \li \c ol
+ \li Ordered list
+ \li Supports the standard \l{list attributes}.
+ \row \li \c p
+ \li Paragraph
+ \li Left-aligned by default. Supports the standard
+ \l{block attributes}.
+ \row \li \c pre
+ \li Preformated text
+ \li
+ \row \li \c qt
+ \li Qt rich-text document
+ \li Synonym for \c html. Provided for compatibility with
+ earlier versions of Qt.
+ \row \li \c s
+ \li Strikethrough
+ \li
+ \row \li \c samp
+ \li Sample code
+ \li Same as \c tt.
+ \row \li \c small
+ \li Small font
+ \li
+ \row \li \c span
+ \li Grouped elements
+ \li
+ \row \li \c strong
+ \li Strong
+ \li Same as \c b.
+ \row \li \c sub
+ \li Subscript
+ \li
+ \row \li \c sup
+ \li Superscript
+ \li
+ \row \li \c table
+ \li Table
+ \li Supports the following attributes: \c border,
+ \c bgcolor (Qt \l{QColor::setNamedColor()}{color names}
+ or \c #RRGGBB), \c cellspacing, \c cellpadding,
+ \c width (absolute or relative), and \c height.
+ \row \li \c tbody
+ \li Table body
+ \li Does nothing.
+ \row \li \c td
+ \li Table data cell
+ \li Supports the standard \l{table cell attributes}.
+ \row \li \c tfoot
+ \li Table footer
+ \li Does nothing.
+ \row \li \c th
+ \li Table header cell
+ \li Supports the standard \l{table cell attributes}.
+ \row \li \c thead
+ \li Table header
+ \li If the \c thead tag is specified, it is used when printing tables
+ that span multiple pages.
+ \row \li \c title
+ \li Document title
+ \li The value specified using the \c
+ title tag is available through
+ QTextDocument::metaInformation().
+ \row \li \c tr
+ \li Table row
+ \li Supports the \c bgcolor attribute, which
+ can be a Qt \l{QColor::setNamedColor()}{color name}
+ or a \c #RRGGBB color specification.
+ \row \li \c tt
+ \li Typewrite font
+ \li
+ \row \li \c u
+ \li Underlined
+ \li
+ \row \li \c ul
+ \li Unordered list
+ \li Supports the standard \l{list attributes}.
+ \row \li \c var
+ \li Variable
+ \li Same as \c i.
+ \endtable
+
+ \section1 Block Attributes
+
+ The following attributes are supported by the \c div, \c dl, \c
+ dt, \c h1, \c h2, \c h3, \c h4, \c h5, \c h6, \c p tags:
+
+ \list
+ \li \c align (\c left, \c right, \c center, \c justify)
+ \li \c dir (\c ltr, \c rtl)
+ \endlist
+
+ \section1 List Attributes
+
+ The following attribute is supported by the \c ol and \c ul tags:
+
+ \list
+ \li \c type (\c 1, \c a, \c A, \c square, \c disc, \c circle)
+ \endlist
+
+ \section1 Table Cell Attributes
+
+ The following attributes are supported by the \c td and \c th
+ tags:
+
+ \list
+ \li \c width (absolute, relative, or no-value)
+ \li \c bgcolor (Qt \l{QColor::setNamedColor()}{color names} or \c #RRGGBB)
+ \li \c colspan
+ \li \c rowspan
+ \li \c align (\c left, \c right, \c center, \c justify)
+ \li \c valign (\c top, \c middle, \c bottom)
+ \endlist
+
+ \section1 CSS Properties
+ The following table lists the CSS properties supported by Qt's
+ \l{Rich Text Processing}{rich text} engine:
+
+ \table
+ \header \li Property
+ \li Values
+ \li Description
+ \row
+ \li \c background-color
+ \li <color>
+ \li Background color for elements
+ \row
+ \li \c background-image
+ \li <uri>
+ \li Background image for elements
+ \row \li \c color
+ \li <color>
+ \li Text foreground color
+ \row \li \c font-family
+ \li <family name>
+ \li Font family name
+ \row \li \c font-size
+ \li [ small | medium | large | x-large | xx-large ] | <size>pt | <size>px
+ \li Font size relative to the document font, or specified in points or pixels
+ \row \li \c font-style
+ \li [ normal | italic | oblique ]
+ \li
+ \row \li \c font-weight
+ \li [ normal | bold | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 ]
+ \li Specifies the font weight used for text, where \c normal and \c bold
+ are mapped to the corresponding QFont weights. Numeric values are
+ 8 times the equivalent QFont weight values.
+ \row \li \c text-decoration
+ \li none | [ underline || overline || line-through ]
+ \li Additional text effects
+ \row \li \c font
+ \li [ [ <'font-style'> || <'font-weight'> ]? <'font-size'> <'font-family'> ]
+ \li Font shorthand property
+ \row \li \c text-indent
+ \li <length>px
+ \li First line text indentation in pixels
+ \row \li \c white-space
+ \li normal | pre | nowrap | pre-wrap
+ \li Declares how whitespace in HTML is handled.
+ \row \li \c margin-top
+ \li <length>px
+ \li Top paragraph margin in pixels
+ \row \li \c margin-bottom
+ \li <length>px
+ \li Bottom paragraph margin in pixels
+ \row \li \c margin-left
+ \li <length>px
+ \li Left paragraph margin in pixels
+ \row \li \c margin-right
+ \li <length>px
+ \li Right paragraph margin in pixels
+ \row \li \c padding-top
+ \li <length>px
+ \li Top table cell padding in pixels
+ \row \li \c padding-bottom
+ \li <length>px
+ \li Bottom table cell padding in pixels
+ \row \li \c padding-left
+ \li <length>px
+ \li Left table cell padding in pixels
+ \row \li \c padding-right
+ \li <length>px
+ \li Right table cell padding in pixels
+ \row \li \c padding
+ \li <length>px
+ \li Shorthand for setting all the padding properties at once.
+ \row \li \c vertical-align
+ \li baseline | sub | super | middle | top | bottom
+ \li Vertical text alignment. For vertical alignment in text table cells only middle, top, and bottom apply.
+ \row \li \c border-color
+ \li <color>
+ \li Border color for text tables.
+ \row \li \c border-style
+ \li none | dotted | dashed | dot-dash | dot-dot-dash | solid | double | groove | ridge | inset | outset
+ \li Border style for text tables.
+ \row \li \c background
+ \li [ <'background-color'> || <'background-image'> ]
+ \li Background shorthand property
+ \row \li \c page-break-before
+ \li [ auto | always ]
+ \li Make it possible to enforce a page break before the paragraph/table
+ \row \li \c page-break-after
+ \li [ auto | always ]
+ \li Make it possible to enforce a page break after the paragraph/table
+ \row \li float
+ \li [ left | right | none ]
+ \li Specifies where an image or a text will be placed in another element. Note that the \c float property is
+ only supported for tables and images.
+ \row \li \c text-transform
+ \li [ uppercase | lowercase ]
+ \li Select the transformation that will be performed on the text prior to displaying it.
+ \row \li \c font-variant
+ \li small-caps
+ \li Perform the smallcaps transformation on the text prior to displaying it.
+ \row \li \c word-spacing
+ \li <width>px
+ \li Specifies an alternate spacing between each word.
+ \endtable
+
+ \section1 Supported CSS Selectors
+
+ All CSS 2.1 selector classes are supported except pseudo-class selectors such
+ as \c{:first-child}, \c{:visited} and \c{:hover}.
+
+*/
diff --git a/src/network/doc/qtnetwork.qdocconf b/src/network/doc/qtnetwork.qdocconf
index 24298c1efd..d15927bced 100644
--- a/src/network/doc/qtnetwork.qdocconf
+++ b/src/network/doc/qtnetwork.qdocconf
@@ -1,37 +1,31 @@
-include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtNetwork
description = Qt Network Reference Documentation
-url = http://qt-project.org/doc/qt-5.0/qtnetwork
+url = http://qt-project.org/doc/qtnetwork
version = 5.0.0
qhp.projects = QtNetwork
qhp.QtNetwork.file = qtnetwork.qhp
qhp.QtNetwork.namespace = org.qt-project.qtnetwork.500
-qhp.QtNetwork.virtualFolder = qdoc
-qhp.QtNetwork.indexTitle = Qt Network Reference Documentation
+qhp.QtNetwork.virtualFolder = qtnetwork
+qhp.QtNetwork.indexTitle = Qt Network
qhp.QtNetwork.indexRoot =
qhp.QtNetwork.filterAttributes = qtnetwork 5.0.0 qtrefdoc
qhp.QtNetwork.customFilters.Qt.name = QtNetwork 5.0.0
qhp.QtNetwork.customFilters.Qt.filterAttributes = qtnetwork 5.0.0
-qhp.QtNetwork.subprojects = classes overviews examples
-qhp.QtNetwork.subprojects.classes.title = Classes
-qhp.QtNetwork.subprojects.classes.indexTitle = Qt Network's Classes
+
+qhp.QtNetwork.subprojects = classes
+qhp.QtNetwork.subprojects.classes.title = C++ Classes
+qhp.QtNetwork.subprojects.classes.indexTitle = Qt Network C++ Classes
qhp.QtNetwork.subprojects.classes.selectors = class fake:headerfile
qhp.QtNetwork.subprojects.classes.sortPages = true
-qhp.QtNetwork.subprojects.overviews.title = Overviews
-qhp.QtNetwork.subprojects.overviews.indexTitle = All Overviews and HOWTOs
-qhp.QtNetwork.subprojects.overviews.selectors = fake:page,group,module
-qhp.QtNetwork.subprojects.examples.title = Qt Network Examples
-qhp.QtNetwork.subprojects.examples.indexTitle = Qt Network Examples
-qhp.QtNetwork.subprojects.examples.selectors = fake:example
tagfile = ../../../doc/qtnetwork/qtnetwork.tags
-depends += qtcore
+depends += qtcore qtgui qtdoc
headerdirs += ..
diff --git a/src/opengl/doc/qtopengl.qdocconf b/src/opengl/doc/qtopengl.qdocconf
index eef1f0f5ba..bdb6a9ebba 100644
--- a/src/opengl/doc/qtopengl.qdocconf
+++ b/src/opengl/doc/qtopengl.qdocconf
@@ -1,37 +1,31 @@
-include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtOpenGL
description = Qt OpenGL Reference Documentation
-url = http://qt-project.org/doc/qt-5.0/qtopengl
+url = http://qt-project.org/doc/qtopengl
version = 5.0.0
qhp.projects = QtOpenGL
qhp.QtOpenGL.file = qtopengl.qhp
qhp.QtOpenGL.namespace = org.qt-project.qtopengl.500
-qhp.QtOpenGL.virtualFolder = qdoc
-qhp.QtOpenGL.indexTitle = Qt OpenGL Reference Documentation
+qhp.QtOpenGL.virtualFolder = qtopengl
+qhp.QtOpenGL.indexTitle = Qt OpenGL
qhp.QtOpenGL.indexRoot =
qhp.QtOpenGL.filterAttributes = qtopengl 5.0.0 qtrefdoc
qhp.QtOpenGL.customFilters.Qt.name = QtOpenGL 5.0.0
qhp.QtOpenGL.customFilters.Qt.filterAttributes = qtopengl 5.0.0
-qhp.QtOpenGL.subprojects = classes overviews examples
-qhp.QtOpenGL.subprojects.classes.title = Classes
-qhp.QtOpenGL.subprojects.classes.indexTitle = Qt OpenGL's Classes
+
+qhp.QtOpenGL.subprojects = classes
+qhp.QtOpenGL.subprojects.classes.title = C++ Classes
+qhp.QtOpenGL.subprojects.classes.indexTitle = Qt OpenGL C++ Classes
qhp.QtOpenGL.subprojects.classes.selectors = class fake:headerfile
qhp.QtOpenGL.subprojects.classes.sortPages = true
-qhp.QtOpenGL.subprojects.overviews.title = Overviews
-qhp.QtOpenGL.subprojects.overviews.indexTitle = All Overviews and HOWTOs
-qhp.QtOpenGL.subprojects.overviews.selectors = fake:page,group,module
-qhp.QtOpenGL.subprojects.examples.title = Qt OpenGL Examples
-qhp.QtOpenGL.subprojects.examples.indexTitle = Qt OpenGL Examples
-qhp.QtOpenGL.subprojects.examples.selectors = fake:example
tagfile = ../../../doc/qtopengl/qtopengl.tags
-depends += qtcore qtgui qtwidgets
+depends += qtcore qtgui qtwidgets qtdoc
headerdirs += ..
diff --git a/src/printsupport/doc/qtprintsupport.qdocconf b/src/printsupport/doc/qtprintsupport.qdocconf
index 45d8225549..321d73e96d 100644
--- a/src/printsupport/doc/qtprintsupport.qdocconf
+++ b/src/printsupport/doc/qtprintsupport.qdocconf
@@ -1,37 +1,31 @@
-include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtPrintSupport
description = Qt Print Support Reference Documentation
-url = http://qt-project.org/doc/qt-5.0/qtprintsupport
+url = http://qt-project.org/doc/qtprintsupport
version = 5.0.0
qhp.projects = QtPrintSupport
qhp.QtPrintSupport.file = qtprintsupport.qhp
qhp.QtPrintSupport.namespace = org.qt-project.qtprintsupport.500
-qhp.QtPrintSupport.virtualFolder = qdoc
-qhp.QtPrintSupport.indexTitle = Qt Print Support Reference Documentation
+qhp.QtPrintSupport.virtualFolder = qtprintsupport
+qhp.QtPrintSupport.indexTitle = Qt Print Support
qhp.QtPrintSupport.indexRoot =
qhp.QtPrintSupport.filterAttributes = qtprintsupport 5.0.0 qtrefdoc
qhp.QtPrintSupport.customFilters.Qt.name = QtPrintSupport 5.0.0
qhp.QtPrintSupport.customFilters.Qt.filterAttributes = qtprintsupport 5.0.0
-qhp.QtPrintSupport.subprojects = classes overviews examples
-qhp.QtPrintSupport.subprojects.classes.title = Classes
-qhp.QtPrintSupport.subprojects.classes.indexTitle = Qt Print Support's Classes
+
+qhp.QtPrintSupport.subprojects = classes
+qhp.QtPrintSupport.subprojects.classes.title = C++ Classes
+qhp.QtPrintSupport.subprojects.classes.indexTitle = Qt Print Support C++ Classes
qhp.QtPrintSupport.subprojects.classes.selectors = class fake:headerfile
qhp.QtPrintSupport.subprojects.classes.sortPages = true
-qhp.QtPrintSupport.subprojects.overviews.title = Overviews
-qhp.QtPrintSupport.subprojects.overviews.indexTitle = All Overviews and HOWTOs
-qhp.QtPrintSupport.subprojects.overviews.selectors = fake:page,group,module
-qhp.QtPrintSupport.subprojects.examples.title = Qt Print Support Examples
-qhp.QtPrintSupport.subprojects.examples.indexTitle = Qt Print Support Examples
-qhp.QtPrintSupport.subprojects.examples.selectors = fake:example
tagfile = ../../../doc/qtprintsupport/qtprintsupport.tags
-depends += qtcore qtgui qtwidgets
+depends += qtcore qtgui qtwidgets qtdoc
headerdirs += ..
diff --git a/src/sql/doc/qtsql.qdocconf b/src/sql/doc/qtsql.qdocconf
index 185f5064fa..e6ed9d6390 100644
--- a/src/sql/doc/qtsql.qdocconf
+++ b/src/sql/doc/qtsql.qdocconf
@@ -1,37 +1,30 @@
-include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtSql
description = Qt SQL Reference Documentation
-url = http://qt-project.org/doc/qt-5.0/qtsql
+url = http://qt-project.org/doc/qtsql
version = 5.0.0
qhp.projects = QtSql
qhp.QtSql.file = qtsql.qhp
qhp.QtSql.namespace = org.qt-project.qtsql.500
-qhp.QtSql.virtualFolder = qdoc
-qhp.QtSql.indexTitle = Qt SQL Reference Documentation
+qhp.QtSql.virtualFolder = qtsql
+qhp.QtSql.indexTitle = Qt SQL
qhp.QtSql.indexRoot =
qhp.QtSql.filterAttributes = qtsql 5.0.0 qtrefdoc
qhp.QtSql.customFilters.Qt.name = QtSql 5.0.0
qhp.QtSql.customFilters.Qt.filterAttributes = qtsql 5.0.0
-qhp.QtSql.subprojects = classes overviews examples
-qhp.QtSql.subprojects.classes.title = Classes
-qhp.QtSql.subprojects.classes.indexTitle = Qt SQL's Classes
+
+qhp.QtSql.subprojects = classes
+qhp.QtSql.subprojects.classes.title = C++ Classes
+qhp.QtSql.subprojects.classes.indexTitle = Qt SQL C++ Classes
qhp.QtSql.subprojects.classes.selectors = class fake:headerfile
qhp.QtSql.subprojects.classes.sortPages = true
-qhp.QtSql.subprojects.overviews.title = Overviews
-qhp.QtSql.subprojects.overviews.indexTitle = All Overviews and HOWTOs
-qhp.QtSql.subprojects.overviews.selectors = fake:page,group,module
-qhp.QtSql.subprojects.examples.title = Qt SQL Examples
-qhp.QtSql.subprojects.examples.indexTitle = Qt SQL Examples
-qhp.QtSql.subprojects.examples.selectors = fake:example
-
tagfile = ../../../doc/qtsql/qtsql.tags
-depends += qtcore
+depends += qtcore qtwidgets qtdoc
headerdirs += ..
diff --git a/src/sql/doc/src/sql-programming.qdoc b/src/sql/doc/src/sql-programming.qdoc
index 3fe2373a73..aa2eb243b8 100644
--- a/src/sql/doc/src/sql-programming.qdoc
+++ b/src/sql/doc/src/sql-programming.qdoc
@@ -463,10 +463,10 @@
The following code snippet shows how the QSqlRelationalTableModel
was set up:
- \snippet sql/relationaltablemodel/relationaltablemodel.cpp 0
+ \snippet relationaltablemodel/relationaltablemodel.cpp 0
\codeline
- \snippet sql/relationaltablemodel/relationaltablemodel.cpp 1
- \snippet sql/relationaltablemodel/relationaltablemodel.cpp 2
+ \snippet relationaltablemodel/relationaltablemodel.cpp 1
+ \snippet relationaltablemodel/relationaltablemodel.cpp 2
See the QSqlRelationalTableModel documentation for details.
*/
@@ -503,7 +503,7 @@
You can use the same model as a data source for multiple views.
If the user edits the model through one of the views, the other
views will reflect the changes immediately. The
- \l{sql/tablemodel}{Table Model} example shows how it works.
+ \l{tablemodel}{Table Model} example shows how it works.
View classes display a header at the top to label the columns. To
change the header texts, call
@@ -511,7 +511,7 @@
model. The header's labels default to the table's field names.
For example:
- \snippet sql/relationaltablemodel/relationaltablemodel.cpp 3
+ \snippet relationaltablemodel/relationaltablemodel.cpp 3
QTableView also has a vertical header on the left with numbers
identifying the rows. If you insert rows programmatically using
@@ -545,16 +545,16 @@
read-write. The following two functions make fields 1 and 2 of a
query model editable:
- \snippet sql/querymodel/editablesqlmodel.cpp 0
+ \snippet querymodel/editablesqlmodel.cpp 0
\codeline
- \snippet sql/querymodel/editablesqlmodel.cpp 1
+ \snippet querymodel/editablesqlmodel.cpp 1
The setFirstName() helper function is defined as follows:
- \snippet sql/querymodel/editablesqlmodel.cpp 2
+ \snippet querymodel/editablesqlmodel.cpp 2
The setLastName() function is similar. See the
- \l{sql/querymodel}{Query Model} example for the complete source code.
+ \l{querymodel}{Query Model} example for the complete source code.
Subclassing a model makes it possible to customize it in many
ways: You can provide tooltips for the items, change the
@@ -570,7 +570,7 @@
\image relationaltable.png Editing a foreign key in a relational table
- The \l{sql/relationaltablemodel}{Relational Table Model} example
+ The \l{relationaltablemodel}{Relational Table Model} example
illustrates how to use QSqlRelationalTableModel in conjunction with
QSqlRelationalDelegate to provide tables with foreign key
support.
@@ -603,7 +603,7 @@
\image qdatawidgetmapper-simple.png
- The \l{sql/books}{Books} example shows how information can
+ The \l{books}{Books} example shows how information can
be presented for easy access by using QDataWidgetMapper and a set of
simple input widgets.
*/
diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp
index 926b78fe9f..c49a1f2fac 100644
--- a/src/sql/models/qsqlquerymodel.cpp
+++ b/src/sql/models/qsqlquerymodel.cpp
@@ -129,7 +129,7 @@ void QSqlQueryModelPrivate::initColOffsets(int size)
option is to use QSqlTableModel, which provides a read-write
model based on a single database table.
- The \l{sql/querymodel} example illustrates how to use
+ The \l{querymodel} example illustrates how to use
QSqlQueryModel to display the result of a query. It also shows
how to subclass QSqlQueryModel to customize the contents of the
data before showing it to the user, and how to create a
diff --git a/src/sql/models/qsqlrelationaldelegate.cpp b/src/sql/models/qsqlrelationaldelegate.cpp
index 31b3df3858..af50c03b2d 100644
--- a/src/sql/models/qsqlrelationaldelegate.cpp
+++ b/src/sql/models/qsqlrelationaldelegate.cpp
@@ -53,9 +53,9 @@ QT_BEGIN_NAMESPACE
use the class, simply call QAbstractItemView::setItemDelegate()
on the view with an instance of QSqlRelationalDelegate:
- \snippet sql/relationaltablemodel/relationaltablemodel.cpp 4
+ \snippet relationaltablemodel/relationaltablemodel.cpp 4
- The \l{sql/relationaltablemodel}{Relational Table Model} example
+ The \l{relationaltablemodel}{Relational Table Model} example
(shown below) illustrates how to use QSqlRelationalDelegate in
conjunction with QSqlRelationalTableModel to provide tables with
foreign key support.
diff --git a/src/sql/models/qsqlrelationaltablemodel.cpp b/src/sql/models/qsqlrelationaltablemodel.cpp
index e249277a86..c3637f0db7 100644
--- a/src/sql/models/qsqlrelationaltablemodel.cpp
+++ b/src/sql/models/qsqlrelationaltablemodel.cpp
@@ -340,10 +340,10 @@ void QSqlRelationalTableModelPrivate::clearCache()
The following code snippet shows how the QSqlRelationalTableModel
was set up:
- \snippet sql/relationaltablemodel/relationaltablemodel.cpp 0
+ \snippet relationaltablemodel/relationaltablemodel.cpp 0
\codeline
- \snippet sql/relationaltablemodel/relationaltablemodel.cpp 1
- \snippet sql/relationaltablemodel/relationaltablemodel.cpp 2
+ \snippet relationaltablemodel/relationaltablemodel.cpp 1
+ \snippet relationaltablemodel/relationaltablemodel.cpp 2
The setRelation() function calls establish a relationship between
two tables. The first call specifies that column 2 in table \c
@@ -359,9 +359,9 @@ void QSqlRelationalTableModelPrivate::clearCache()
call QAbstractItemView::setItemDelegate() on the view with an
instance of QSqlRelationalDelegate:
- \snippet sql/relationaltablemodel/relationaltablemodel.cpp 4
+ \snippet relationaltablemodel/relationaltablemodel.cpp 4
- The \l{sql/relationaltablemodel} example illustrates how to use
+ The \l{relationaltablemodel} example illustrates how to use
QSqlRelationalTableModel in conjunction with
QSqlRelationalDelegate to provide tables with foreign key
support.
@@ -486,9 +486,9 @@ bool QSqlRelationalTableModel::setData(const QModelIndex &index, const QVariant
Example:
- \snippet sql/relationaltablemodel/relationaltablemodel.cpp 0
+ \snippet relationaltablemodel/relationaltablemodel.cpp 0
\codeline
- \snippet sql/relationaltablemodel/relationaltablemodel.cpp 1
+ \snippet relationaltablemodel/relationaltablemodel.cpp 1
The setRelation() call specifies that column 2 in table \c
employee is a foreign key that maps with field \c id of table \c
diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp
index 5feb3087b8..d685c7e0be 100644
--- a/src/sql/models/qsqltablemodel.cpp
+++ b/src/sql/models/qsqltablemodel.cpp
@@ -251,7 +251,7 @@ QSqlRecord QSqlTableModelPrivate::primaryValues(int row) const
sort order using setSort(). At the end, you must call select() to
populate the model with data.
- The \l{sql/tablemodel} example illustrates how to use
+ The \l{tablemodel} example illustrates how to use
QSqlTableModel as the data source for a QTableView.
QSqlTableModel provides no direct support for foreign keys. Use
diff --git a/src/testlib/doc/qttest.qdocconf b/src/testlib/doc/qttest.qdocconf
index fd9d6a83d5..ff36e43fd4 100644
--- a/src/testlib/doc/qttest.qdocconf
+++ b/src/testlib/doc/qttest.qdocconf
@@ -1,37 +1,31 @@
-include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtTest
description = Qt Test Reference Documentation
-url = http://qt-project.org/doc/qt-5.0/qttest
+url = http://qt-project.org/doc/qttest
version = 5.0.0
qhp.projects = QtTest
qhp.QtTest.file = qttest.qhp
qhp.QtTest.namespace = org.qt-project.qttest.500
-qhp.QtTest.virtualFolder = qdoc
-qhp.QtTest.indexTitle = Qt Test Reference Documentation
+qhp.QtTest.virtualFolder = qttest
+qhp.QtTest.indexTitle = Qt Test
qhp.QtTest.indexRoot =
qhp.QtTest.filterAttributes = qttest 5.0.0 qtrefdoc
qhp.QtTest.customFilters.Qt.name = QtTest 5.0.0
qhp.QtTest.customFilters.Qt.filterAttributes = qttest 5.0.0
-qhp.QtTest.subprojects = classes overviews examples
-qhp.QtTest.subprojects.classes.title = Classes
-qhp.QtTest.subprojects.classes.indexTitle = Qt Test's Classes
+
+qhp.QtTest.subprojects = classes
+qhp.QtTest.subprojects.classes.title = C++ Classes
+qhp.QtTest.subprojects.classes.indexTitle = Qt Test C++ Classes
qhp.QtTest.subprojects.classes.selectors = class fake:headerfile
qhp.QtTest.subprojects.classes.sortPages = true
-qhp.QtTest.subprojects.overviews.title = Overviews
-qhp.QtTest.subprojects.overviews.indexTitle = All Overviews and HOWTOs
-qhp.QtTest.subprojects.overviews.selectors = fake:page,group,module
-qhp.QtTest.subprojects.examples.title = Qt Test Examples
-qhp.QtTest.subprojects.examples.indexTitle = Qt Test Examples
-qhp.QtTest.subprojects.examples.selectors = fake:example
tagfile = ../../../doc/qttest/qttest.tags
-depends += qtcore
+depends += qtcore qtdoc qtwidgets qtgui
headerdirs += ..
diff --git a/src/testlib/doc/src/qttest-index.qdoc b/src/testlib/doc/src/qttest-index.qdoc
new file mode 100644
index 0000000000..f536529420
--- /dev/null
+++ b/src/testlib/doc/src/qttest-index.qdoc
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/*!
+ \page qttest-index.html
+ \title Qt Test
+ \brief Provides classes for unit testing Qt applications and libraries.
+
+ Qt Test provides classes for unit testing Qt applications and libraries.
+ All public methods are in the \l QTest namespace. In addition, the
+ \l QSignalSpy class provides easy introspection for Qt's signals and slots.
+
+ \section1 Getting Started
+
+ To enable Qt Test in a project, add this directive into the C++ files:
+
+ \snippet code/doc_src_qttest.cpp 0
+
+ To link against Qt Test, add this line to the project file:
+
+ \snippet code/doc_src_qttest.pro 1
+
+ \section1 Articles and Guides
+
+ \list
+ \li \l{Qt Test Overview}
+ \li \l{Qt Test Tutorial}
+ \endlist
+
+ \section1 Reference
+
+ These are links to the API reference materials.
+
+ \list
+ \li \l{Qt Test C++ Classes}{C++ Classes}
+ \endlist
+
+*/
+
diff --git a/src/testlib/doc/src/qttest.qdoc b/src/testlib/doc/src/qttest.qdoc
index f0a9d80a5d..8044b45f99 100644
--- a/src/testlib/doc/src/qttest.qdoc
+++ b/src/testlib/doc/src/qttest.qdoc
@@ -27,15 +27,15 @@
/*!
\module QtTest
- \title QtTest Module
+ \title Qt Test C++ Classes
\ingroup modules
\keyword QtTest
- \brief The QtTest module provides classes for unit testing Qt applications and libraries.
+ \brief Provides classes for unit testing Qt applications and libraries.
Applications that use Qt's unit testing classes need to
- be configured to be built against the QtTest module.
+ be configured to be built against the Qt Test module.
To include the definitions of the module's classes, use the
following directive:
@@ -46,9 +46,8 @@
\snippet code/doc_src_qttest.pro 1
- See the \l{QTestLib Manual} for a detailed introduction on how to use
+ See \l{Qt Test Overview} for an introduction on how to use
Qt's unit testing features with your applications.
- The QtTest module is part of all \l{Qt editions}.
*/
diff --git a/src/testlib/doc/src/qttestlib-manual.qdoc b/src/testlib/doc/src/qttestlib-manual.qdoc
index e7ee787d08..1ba9763a35 100644
--- a/src/testlib/doc/src/qttestlib-manual.qdoc
+++ b/src/testlib/doc/src/qttestlib-manual.qdoc
@@ -26,51 +26,49 @@
****************************************************************************/
/*!
- \page qtestlib-manual.html
- \title QTestLib Manual
- \brief An overview of Qt's unit testing framework.
+ \page qtest-overview.html
+ \title Qt Test Overview
+ \brief Overview of the Qt unit testing framework.
\ingroup frameworks-technologies
\ingroup qt-basic-concepts
\keyword qtestlib
- The QTestLib framework, provided by Nokia, is a tool for unit
- testing Qt based applications and libraries. QTestLib provides
+ Qt Test is a framework for unit testing Qt based applications and libraries.
+ Qt Test provides
all the functionality commonly found in unit testing frameworks as
well as extensions for testing graphical user interfaces.
- \section1 QTestLib Features
-
- QTestLib is designed to ease the writing of unit tests for Qt
+ Qt Test is designed to ease the writing of unit tests for Qt
based applications and libraries:
\table
\header \li Feature \li Details
\row
\li \b Lightweight
- \li QTestLib consists of about 6000 lines of code and 60
+ \li Qt Test consists of about 6000 lines of code and 60
exported symbols.
\row
\li \b Self-contained
- \li QTestLib requires only a few symbols from the Qt Core library
+ \li Qt Test requires only a few symbols from the Qt Core library
for non-gui testing.
\row
\li \b {Rapid testing}
- \li QTestLib needs no special test-runners; no special
+ \li Qt Test needs no special test-runners; no special
registration for tests.
\row
\li \b {Data-driven testing}
\li A test can be executed multiple times with different test data.
\row
\li \b {Basic GUI testing}
- \li QTestLib offers functionality for mouse and keyboard simulation.
+ \li Qt Test offers functionality for mouse and keyboard simulation.
\row
\li \b {Benchmarking}
- \li QTestLib supports benchmarking and provides several measurement back-ends.
+ \li Qt Test supports benchmarking and provides several measurement back-ends.
\row
\li \b {IDE friendly}
- \li QTestLib outputs messages that can be interpreted by Visual
+ \li Qt Test outputs messages that can be interpreted by Visual
Studio and KDevelop.
\row
\li \b Thread-safety
@@ -84,41 +82,33 @@
\li Custom types can easily be added to the test data and test output.
\endtable
- \section1 QTestLib API
-
- All public methods are in the \l QTest namespace. In addition, the
- \l QSignalSpy class provides easy introspection for Qt's signals and slots.
-
-
- \section1 Using QTestLib
-
- \section2 Creating a Test
+ \section1 Creating a Test
To create a test, subclass QObject and add one or more private slots to it. Each
- private slot is a testfunction in your test. QTest::qExec() can be used to execute
- all testfunctions in the test object.
+ private slot is a test function in your test. QTest::qExec() can be used to execute
+ all test functions in the test object.
- In addition, there are four private slots that are \e not treated as testfunctions.
+ In addition, there are four private slots that are \e not treated as test functions.
They will be executed by the testing framework and can be used to initialize and
clean up either the entire test or the current test function.
\list
- \li \c{initTestCase()} will be called before the first testfunction is executed.
- \li \c{cleanupTestCase()} will be called after the last testfunction was executed.
- \li \c{init()} will be called before each testfunction is executed.
- \li \c{cleanup()} will be called after every testfunction.
+ \li \c{initTestCase()} will be called before the first test function is executed.
+ \li \c{cleanupTestCase()} will be called after the last test function was executed.
+ \li \c{init()} will be called before each test function is executed.
+ \li \c{cleanup()} will be called after every test function.
\endlist
- If \c{initTestCase()} fails, no testfunction will be executed. If \c{init()} fails,
- the following testfunction will not be executed, the test will proceed to the next
- testfunction.
+ If \c{initTestCase()} fails, no test function will be executed. If \c{init()} fails,
+ the following test function will not be executed, the test will proceed to the next
+ test function.
Example:
\snippet code/doc_src_qtestlib.cpp 0
- For more examples, refer to the \l{QTestLib Tutorial}.
+ For more examples, refer to the \l{Qt Test Tutorial}.
- \section2 Building a Test
+ \section1 Building a Test
If you are using \c qmake as your build tool, just add the
following to your project file:
@@ -134,7 +124,7 @@
more information about \c{make check}.
If you are using other build tools, make sure that you add the location
- of the QTestLib header files to your include path (usually \c{include/QtTest}
+ of the Qt Test header files to your include path (usually \c{include/QtTest}
under your Qt installation directory). If you are using a release build
of Qt, link your test to the \c QtTest library. For debug builds, use
\c{QtTest_debug}.
@@ -142,9 +132,9 @@
See \l {Chapter 1: Writing a Unit Test}{Writing a Unit Test} for a step by
step explanation.
- \section2 QTestLib Command Line Arguments
+ \section1 Qt Test Command Line Arguments
- \section3 Syntax
+ \section2 Syntax
The syntax to execute an autotest takes the following simple form:
@@ -165,37 +155,37 @@
\snippet code/doc_src_qtestlib.qdoc 4
Runs the \c toUpper test function with all available test data,
- and the \c toInt test function with the testdata called \c
+ and the \c toInt test function with the test data called \c
zero (if the specified test data doesn't exist, the associated test
will fail).
\snippet code/doc_src_qtestlib.qdoc 5
- Runs the testMyWidget function test, outputs every signal
+ Runs the \c testMyWidget function test, outputs every signal
emission and waits 500 milliseconds after each simulated
mouse/keyboard event.
- \section3 Options
+ \section2 Options
- \section4 Logging Options
+ \section3 Logging Options
The following command line options determine how test results are reported:
\list
\li \c -o \e{filename,format} \br
- write output to the specified file, in the specified format (one of
+ Writes output to the specified file, in the specified format (one of
\c txt, \c xml, \c lightxml or \c xunitxml). The special filename \c -
may be used to log to standard output.
\li \c -o \e filename \br
- write output to the specified file.
+ Writes output to the specified file.
\li \c -txt \br
- outputs results in plain text.
+ Outputs results in plain text.
\li \c -xml \br
- outputs results as an XML document.
+ Outputs results as an XML document.
\li \c -lightxml \br
- outputs results as a stream of XML tags.
+ Outputs results as a stream of XML tags.
\li \c -xunitxml \br
- outputs results as an Xunit XML document.
+ Outputs results as an Xunit XML document.
\endlist
The first version of the \c -o option may be repeated in order to log
@@ -210,81 +200,84 @@
standard output. If no format option is used, test results will be logged in
plain text.
- \section4 Test Log Detail Options
+ \section3 Test Log Detail Options
The following command line options control how much detail is reported
in test logs:
\list
\li \c -silent \br
- silent output, only shows fatal errors, test failures and minimal status messages.
+ Silent output; only shows fatal errors, test failures and minimal status
+ messages.
\li \c -v1 \br
- verbose output; shows when each test function is entered.
+ Verbose output; shows when each test function is entered.
(This option only affects plain text output.)
\li \c -v2 \br
- extended verbose output; shows each \l QCOMPARE() and \l QVERIFY().
+ Extended verbose output; shows each \l QCOMPARE() and \l QVERIFY().
(This option affects all output formats and implies \c -v1 for plain text output.)
\li \c -vs \br
- shows every signal that gets emitted and the slot invocations resulting from those signals.
+ Shows all signals that get emitted and the slot invocations resulting from
+ those signals.
(This option affects all output formats.)
\endlist
- \section4 Testing Options
+ \section3 Testing Options
The following command-line options influence how tests are run:
\list
\li \c -functions \br
- outputs all test functions available in the test, then quits.
+ Outputs all test functions available in the test, then quits.
\li \c -datatags \br
- outputs all data tags available in the test.
+ Outputs all data tags available in the test.
A global data tag is preceded by ' __global__ '.
\li \c -eventdelay \e ms \br
- if no delay is specified for keyboard or mouse simulation
+ If no delay is specified for keyboard or mouse simulation
(\l QTest::keyClick(),
\l QTest::mouseClick() etc.), the value from this parameter
(in milliseconds) is substituted.
\li \c -keydelay \e ms \br
- like -eventdelay, but only influences keyboard simulation and not mouse
+ Like -eventdelay, but only influences keyboard simulation and not mouse
simulation.
\li \c -mousedelay \e ms \br
- like -eventdelay, but only influences mouse simulation and not keyboard
+ Like -eventdelay, but only influences mouse simulation and not keyboard
simulation.
- \li \c -maxwarnings \e number\br
- sets the maximum number of warnings to output. 0 for unlimited, defaults to 2000.
+ \li \c -maxwarnings \e number \br
+ Sets the maximum number of warnings to output. 0 for unlimited, defaults to
+ 2000.
\li \c -nocrashhandler \br
- disables the crash handler on Unix platforms.
+ Disables the crash handler on Unix platforms.
\endlist
- \section4 Benchmarking Options
+ \section3 Benchmarking Options
The following command line options control benchmark testing:
\list
\li \c -callgrind \br
- use callgrind to time benchmarks (Linux only).
+ Uses Callgrind to time benchmarks (Linux only).
\li \c -tickcounter \br
- use CPU tick counters to time benchmarks.
+ Uses CPU tick counters to time benchmarks.
\li \c -eventcounter \br
- counts events received during benchmarks.
+ Counts events received during benchmarks.
\li \c -minimumvalue \e n \br
- sets the minimum acceptable measurement value.
+ Sets the minimum acceptable measurement value.
\li \c -iterations \e n \br
- sets the number of accumulation iterations.
+ Sets the number of accumulation iterations.
\li \c -median \e n \br
- sets the number of median iterations.
+ Sets the number of median iterations.
\li \c -vb \br
- output verbose benchmarking information.
+ Outputs verbose benchmarking information.
\endlist
- \section4 Miscellaneous Options
+ \section3 Miscellaneous Options
\list
\li \c -help \br
- outputs the possible command line arguments and give some useful help.
+ Outputs the possible command line arguments and gives some useful help.
\endlist
- \section2 Creating a Benchmark
+ \section1 Creating a Benchmark
To create a benchmark, follow the instructions for creating a test and then add a
QBENCHMARK macro to the test function that you want to benchmark.
@@ -308,7 +301,7 @@
\row \li CPU tick counter
\li -tickcounter
\li Windows, Mac OS X, Linux, many UNIX-like systems.
- \row \li Valgrind/Callgrind
+ \row \li Valgrind Callgrind
\li -callgrind
\li Linux (if installed)
\row \li Event Counter
@@ -328,15 +321,17 @@
that were received by the event loop before they are sent to their corresponding
targets (this might include non-Qt events).
- \note Depending on the device configuration, Tick counters on the
+ \note Depending on the device configuration, tick counters on the
Windows CE platform may not be as fine-grained, compared to other platforms.
Devices that do not support high-resolution timers default to
one-millisecond granularity.
- See the chapter 5 in the \l{QTestLib Tutorial} for more benchmarking examples.
+ See \l {Chapter 5: Writing a Benchmark}{Writing a Benchmark} in the Qt Test
+ Tutorial for more benchmarking examples.
+
+ \section1 Using Qt Test Remotely on Windows CE
- \section1 Using QTestLib remotely on Windows CE
- \c cetest is a convenience application which helps the user to launch an
+ The \c cetest convenience application enables you to launch an
application remotely on a Windows CE device or emulator.
It needs to be executed after the unit test has been successfully compiled.
@@ -350,32 +345,31 @@
\li all files specified in the \c .pro file following the \l DEPLOYMENT rules.
\endlist
- \section2 Using \c cetest
- \section3 Syntax
+ \section2 Syntax
The syntax to execute an autotest takes the following simple form:
\snippet code/doc_src_qtestlib.qdoc 6
- \section3 Options
+ \section2 Options
\c cetest provides the same options as those for unit-testing on non cross-compiled
- platforms. See \l {QTestLib Command Line Arguments} {Command Line Arguments} for
+ platforms. See \l {Qt Test Command Line Arguments} {Command Line Arguments} for
more information.
The following commands are also included:
\list
\li \c -debug \br
- Test version compiled in debug mode.
+ Compiles the test version in debug mode.
\li \c -release \br
- Test version compiled in release mode.
+ Compiles the test version in release mode.
\li \c -libpath \e path \br
- Target path to copy Qt libraries to.
+ Copies Qt libraries to the specified path.
\li \c -qt-delete \br
- Delete Qt libraries after execution.
+ Deletes Qt libraries after execution.
\li \c -project-delete \br
- Delete project files after execution.
+ Deletes project files after execution.
\li \c -delete \br
- Delete project and Qt libraries after execution.
+ Deletes project and Qt libraries after execution.
\li \c -conf \br
Specifies a qt.conf file to be deployed to remote directory.
\endlist
@@ -383,7 +377,7 @@
\note \c{debug} is the default build option.
\section2 QtRemote
- \c QtRemote is a small library which is build after QTestLib. It allows the host
+ \c QtRemote is a small library which is built after Qt Test. It allows the host
system to create a process on a remote device and waits until its execution has
been finished.
@@ -404,7 +398,7 @@
\section1 3rd Party Code
- The CPU tick counters used for benchmarking is licensed under the following
+ The CPU tick counters used for benchmarking are licensed under the following
license: (from src/testlib/3rdparty/cycle.h)
\legalese
@@ -433,16 +427,16 @@
*/
/*!
- \page qtestlib-tutorial.html
- \brief A short introduction to testing with QTestLib.
- \contentspage QTestLib Manual
+ \page qtest-tutorial.html
+ \brief A short introduction to testing with Qt Test.
+ \contentspage Qt Test Overview
\nextpage {Chapter 1: Writing a Unit Test}{Chapter 1}
\ingroup best-practices
- \title QTestLib Tutorial
+ \title Qt Test Tutorial
This tutorial gives a short introduction to how to use some of the
- features of the QTestLib framework. It is divided into five
+ features of the Qt Test framework. It is divided into five
chapters:
\list 1
@@ -459,7 +453,7 @@
/*!
\example tutorial1
- \contentspage {QTestLib Tutorial}{Contents}
+ \contentspage {Qt Test Tutorial}{Contents}
\nextpage {Chapter 2: Data Driven Testing}{Chapter 2}
\title Chapter 1: Writing a Unit Test
@@ -475,9 +469,8 @@
\snippet tutorial1/testqstring.cpp 0
- Note that you need to include the QTest header, and that the
- test functions have to be declared as private slots so the
- test framework finds and executes it.
+ \note You need to include the QTest header and declare the test functions as
+ private slots so the test framework finds and executes it.
Then you need to implement the test function itself. The
implementation could look like this:
@@ -495,7 +488,7 @@
\snippet tutorial1/testqstring.cpp 1
- If the strings are not equal, the contents of both strings is
+ If the strings are not equal, the contents of both strings are
appended to the test log, making it immediately visible why the
comparison failed.
@@ -514,12 +507,12 @@
Now that we finished writing our test, we want to execute
it. Assuming that our test was saved as \c testqstring.cpp in an
- empty directory: we build the test using qmake to create a project
+ empty directory, we build the test using qmake to create a project
and generate a makefile.
\snippet code/doc_src_qtestlib.qdoc 9
- \b {Note:}If you're using windows, replace \c make with \c
+ \note If you're using windows, replace \c make with \c
nmake or whatever build tool you use.
Running the resulting executable should give you the following
@@ -528,14 +521,14 @@
\snippet code/doc_src_qtestlib.qdoc 10
Congratulations! You just wrote and executed your first unit test
- using the QTestLib framework.
+ using the Qt Test framework.
*/
/*!
\example tutorial2
\previouspage {Chapter 1: Writing a Unit Test}{Chapter 1}
- \contentspage {QTestLib Tutorial}{Contents}
+ \contentspage {Qt Test Tutorial}{Contents}
\nextpage {Chapter 3: Simulating Gui Events}{Chapter 3}
\title Chapter 2: Data Driven Testing
@@ -550,7 +543,7 @@
\snippet code/doc_src_qtestlib.cpp 11
To prevent that the function ends up being cluttered by repetitive
- code, QTestLib supports adding test data to a test function. All
+ code, Qt Test supports adding test data to a test function. All
we need is to add another private slot to our test class:
\snippet tutorial2/testqstring.cpp 0
@@ -563,7 +556,7 @@
\snippet tutorial2/testqstring.cpp 1
First, we define the two elements of our test table using the \l
- QTest::addColumn() function: A test string, and the
+ QTest::addColumn() function: a test string, and the
expected result of applying the QString::toUpper() function to
that string.
@@ -571,10 +564,10 @@
QTest::newRow() function. Each set of data will become a
separate row in the test table.
- \l QTest::newRow() takes one argument: A name that will be
+ \l QTest::newRow() takes one argument: a name that will be
associated with the data set. If the test fails, the name will be
used in the test log, referencing the failed data. Then we
- stream the data set into the new table row: First an arbitrary
+ stream the data set into the new table row. First an arbitrary
string, and then the expected result of applying the
QString::toUpper() function to that string.
@@ -640,17 +633,17 @@
\example tutorial3
\previouspage {Chapter 2: Data Driven Testing}{Chapter 2}
- \contentspage {QTestLib Tutorial}{Contents}
+ \contentspage {Qt Test Tutorial}{Contents}
\nextpage {Chapter 4: Replaying GUI Events}{Chapter 4}
\title Chapter 3: Simulating GUI Events
- QTestLib features some mechanisms to test graphical user
+ Qt Test features some mechanisms to test graphical user
interfaces. Instead of simulating native window system events,
- QTestLib sends internal Qt events. That means there are no
+ Qt Test sends internal Qt events. That means there are no
side-effects on the machine the tests are running on.
- In this chapter we will se how to write a simple GUI test.
+ In this chapter we will see how to write a simple GUI test.
\section1 Writing a GUI test
@@ -699,8 +692,8 @@
/*!
\example tutorial4
- \previouspage {Chapter 3: Simulating GUI Event}{Chapter 3}
- \contentspage {QTestLib Tutorial}{Contents}
+ \previouspage {Chapter 3: Simulating GUI Events}{Chapter 3}
+ \contentspage {Qt Test Tutorial}{Contents}
\nextpage {Chapter 5: Writing a Benchmark}{Chapter 5}
\title Chapter 4: Replaying GUI Events
@@ -709,9 +702,9 @@
and how to store a series of GUI events as well as replay them on
a widget.
- The approach to storing a series of events and replay them, is
+ The approach to storing a series of events and replaying them is
quite similar to the approach explained in \l {Chapter 2:
- Data Driven Testing}{chapter 2}; all you need is to add a data
+ Data Driven Testing}{chapter 2}. All you need to do is to add a data
function to your test class:
\snippet tutorial4/testgui.cpp 0
@@ -733,7 +726,7 @@
QWidget.
In our current data function, we create two \l
- {QTestEventList}s. The first list consists of a single click to
+ {QTestEventList} elements. The first list consists of a single click to
the 'a' key. We add the event to the list using the
QTestEventList::addKeyClick() function. Then we use the
QTest::newRow() function to give the data set a name, and
@@ -756,7 +749,7 @@
associated TestGui::testGui_data() function.
First, we fetch the two elements of the data set using the \l
- QFETCH() macro. \l QFETCH() takes two arguments: The data type of
+ QFETCH() macro. \l QFETCH() takes two arguments: the data type of
the element and the element name. Then we create a QLineEdit, and
apply the list of events on that widget using the
QTestEventList::simulate() function.
@@ -780,12 +773,12 @@
\example tutorial5
\previouspage {Chapter 4: Replaying GUI Events}{Chapter 4}
- \contentspage {QTestLib Tutorial}{Contents}
+ \contentspage {Qt Test Tutorial}{Contents}
\title Chapter 5: Writing a Benchmark
In this final chapter we will demonstrate how to write benchmarks
- using QTestLib.
+ using Qt Test.
\section1 Writing a Benchmark
To create a benchmark we extend a test function with a QBENCHMARK macro.
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 025710b3b7..6f8b12bded 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -93,10 +93,9 @@ QT_BEGIN_NAMESPACE
\inmodule QtTest
\brief The QTest namespace contains all the functions and
- declarations that are related to the QTestLib tool.
+ declarations that are related to Qt Test.
- Please refer to the \l{QTestLib Manual} documentation for information on
- how to write unit tests.
+ See the \l{Qt Test Overview} for information about how to write unit tests.
*/
/*! \macro QVERIFY(condition)
@@ -486,7 +485,7 @@ QT_BEGIN_NAMESPACE
\snippet qtestlib/tutorial5/benchmarking.cpp 0
- \sa {QTestLib Manual#Creating a Benchmark}{Creating a Benchmark},
+ \sa {Qt Test Overview#Creating a Benchmark}{Creating a Benchmark},
{Chapter 5: Writing a Benchmark}{Writing a Benchmark}
*/
@@ -507,7 +506,7 @@ QT_BEGIN_NAMESPACE
once. The elapsed time will be reported as "0" if it's to short to
be measured by the selected backend. (Use)
- \sa {QTestLib Manual#Creating a Benchmark}{Creating a Benchmark},
+ \sa {Qt Test Overview#Creating a Benchmark}{Creating a Benchmark},
{Chapter 5: Writing a Benchmark}{Writing a Benchmark}
*/
diff --git a/src/tools/qdoc/codeparser.cpp b/src/tools/qdoc/codeparser.cpp
index 6ecca78a70..ea3bdc25f4 100644
--- a/src/tools/qdoc/codeparser.cpp
+++ b/src/tools/qdoc/codeparser.cpp
@@ -387,4 +387,80 @@ bool CodeParser::isParsingQdoc() const
return currentFile_.endsWith(".qdoc");
}
+/*!
+ For each node that will produce a documentation page, this function
+ ensures that the node belongs to a module. Normally, the qdoc comment
+ for an entity that will produce a documentation page will contain an
+ \inmodule command to tell qdoc which module the entity belongs to.
+
+ But now that we normally run qdoc on each module in two passes. The
+ first produces an index file; the second pass generates the docs
+ after reading all the index files it needs.
+
+ This means that all the pages generated during each pass 2 run of
+ qdoc almost certainly belong to a single module, and the name of
+ that module is, as a rule, used as the project name in the qdocconf
+ file used when running qdoc on the module.
+
+ So this function first asks if the node \a n has a non-empty module
+ name. If it it does not have a non-empty module name, it sets the
+ module name to be the project name.
+
+ In some cases it prints a qdoc warning that it has done this. Namely,
+ for C++ classes and namespaces.
+ */
+void CodeParser::checkModuleInclusion(Node* n)
+{
+ if (n->moduleName().isEmpty()) {
+ switch (n->type()) {
+ case Node::Class:
+ if (n->access() != Node::Private && !n->doc().isEmpty()) {
+ n->setModuleName(Generator::defaultModuleName());
+ n->doc().location().warning(tr("Class %1 has no \\inmodule command; "
+ "using project name by default: %2")
+ .arg(n->name()).arg(Generator::defaultModuleName()));
+ }
+ break;
+ case Node::Namespace:
+ if (n->access() != Node::Private && !n->name().isEmpty() && !n->doc().isEmpty()) {
+ n->setModuleName(Generator::defaultModuleName());
+ n->doc().location().warning(tr("Namespace %1 has no \\inmodule command; "
+ "using project name by default: %2")
+ .arg(n->name()).arg(Generator::defaultModuleName()));
+ }
+ break;
+ case Node::Document:
+ if (n->access() != Node::Private && !n->doc().isEmpty()) {
+ if (n->subType() == Node::HeaderFile) {
+ n->setModuleName(Generator::defaultModuleName());
+#if 0
+ n->doc().location().warning(tr("Header file with title \"%1\" has no \\inmodule command; "
+ "using project name by default: %2")
+ .arg(n->title()).arg(Generator::defaultModuleName()));
+#endif
+ }
+ else if (n->subType() == Node::Page) {
+ n->setModuleName(Generator::defaultModuleName());
+#if 0
+ n->doc().location().warning(tr("Page with title \"%1\" has no \\inmodule command; "
+ "using project name by default: %2")
+ .arg(n->title()).arg(Generator::defaultModuleName()));
+#endif
+ }
+ else if (n->subType() == Node::Example) {
+ n->setModuleName(Generator::defaultModuleName());
+#if 0
+ n->doc().location().warning(tr("Example with title \"%1\" has no \\inmodule command; "
+ "using project name by default: %2")
+ .arg(n->title()).arg(Generator::defaultModuleName()));
+#endif
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/tools/qdoc/codeparser.h b/src/tools/qdoc/codeparser.h
index 3d6bf89070..06839ffd80 100644
--- a/src/tools/qdoc/codeparser.h
+++ b/src/tools/qdoc/codeparser.h
@@ -72,6 +72,7 @@ public:
bool isParsingCpp() const;
bool isParsingQdoc() const;
const QString& currentFile() const { return currentFile_; }
+ void checkModuleInclusion(Node* n);
static void initialize(const Config& config);
static void terminate();
diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp
index 1ecfb6ddaf..e75ab85406 100644
--- a/src/tools/qdoc/config.cpp
+++ b/src/tools/qdoc/config.cpp
@@ -50,6 +50,7 @@
#include <qtextstream.h>
#include <qdebug.h>
#include "config.h"
+#include "generator.h"
#include <stdlib.h>
QT_BEGIN_NAMESPACE
@@ -154,6 +155,7 @@ QString Config::installDir;
QSet<QString> Config::overrideOutputFormats;
QMap<QString, QString> Config::extractedDirs;
int Config::numInstances;
+QStack<QString> Config::workingDirs_;
/*!
\class Config
@@ -171,10 +173,10 @@ Config::Config(const QString& programName)
: prog(programName)
{
loc = Location::null;
- lastLoc = Location::null;
+ lastLocation_ = Location::null;
locMap.clear();
- stringValueMap.clear();
- stringListValueMap.clear();
+ stringPairMap.clear();
+ stringListPairMap.clear();
numInstances++;
}
@@ -203,7 +205,7 @@ void Config::load(const QString& fileName)
else {
loc.setEtc(true);
}
- lastLoc = Location::null;
+ lastLocation_ = Location::null;
}
/*!
@@ -212,9 +214,9 @@ void Config::load(const QString& fileName)
*/
void Config::unload(const QString& fileName)
{
- QStringMultiMap::ConstIterator v = stringValueMap.constBegin();
- while (v != stringValueMap.constEnd()) {
- qDebug() << v.key() << " = " << v.value();
+ QStringPairMap::ConstIterator v = stringPairMap.constBegin();
+ while (v != stringPairMap.constEnd()) {
+ qDebug() << v.key() << " = " << v.value().second;
++v;
}
qDebug() << "fileName:" << fileName;
@@ -229,8 +231,10 @@ void Config::unload(const QString& fileName)
*/
void Config::setStringList(const QString& var, const QStringList& values)
{
- stringValueMap[var] = values.join(QLatin1Char(' '));
- stringListValueMap[var] = values;
+ stringPairMap[var].first = QDir::currentPath();
+ stringPairMap[var].second = values.join(QLatin1Char(' '));
+ stringListPairMap[var].first = QDir::currentPath();
+ stringListPairMap[var].second = values;
}
/*!
@@ -290,16 +294,37 @@ QSet<QString> Config::getOutputFormats() const
/*!
First, this function looks up the configuration variable \a var
in the location map and, if found, sets the internal variable
- \c{lastLoc} to the Location that \a var maps to.
+ \c{lastLocation_} to the Location that \a var maps to.
Then it looks up the configuration variable \a var in the string
- map, and returns the string that \a var maps to.
+ map and returns the string that \a var maps to.
*/
QString Config::getString(const QString& var) const
{
if (!locMap[var].isEmpty())
- (Location&) lastLoc = locMap[var];
- return stringValueMap[var];
+ (Location&) lastLocation_ = locMap[var];
+ return stringPairMap[var].second;
+}
+
+/*!
+ This function looks up the variable \a var in the location map
+ and, if found, sets the internal variable \c{lastLocation_} to the
+ location that \a var maps to.
+
+ Then it looks up \a var in the configuration variable map and,
+ if found, constructs a path from the pair value, which consists
+ of the directory path of the configuration file where the value
+ came from, and the value itself. The constructed path is returned.
+ */
+QString Config::getPath(const QString& var) const
+{
+ if (!locMap[var].isEmpty())
+ (Location&) lastLocation_ = locMap[var];
+ QString path;
+ if (stringPairMap.contains(var)) {
+ path = QDir(stringPairMap[var].first + "/" + stringPairMap[var].second).absolutePath();
+ }
+ return path;
}
/*!
@@ -315,7 +340,7 @@ QSet<QString> Config::getStringSet(const QString& var) const
/*!
First, this function looks up the configuration variable \a var
in the location map and, if found, sets the internal variable
- \c{lastLoc} to the Location that \a var maps to.
+ \c{lastLocation_} to the Location that \a var maps to.
Then it looks up the configuration variable \a var in the string
list map, and returns the string list that \a var maps to.
@@ -323,8 +348,8 @@ QSet<QString> Config::getStringSet(const QString& var) const
QStringList Config::getStringList(const QString& var) const
{
if (!locMap[var].isEmpty())
- (Location&) lastLoc = locMap[var];
- return stringListValueMap[var];
+ (Location&) lastLocation_ = locMap[var];
+ return stringListPairMap[var].second;
}
@@ -337,11 +362,11 @@ QStringList Config::getStringList(const QString& var) const
QStringList Config::getCanonicalRelativePathList(const QString& var) const
{
if (!locMap[var].isEmpty())
- (Location&) lastLoc = locMap[var];
+ (Location&) lastLocation_ = locMap[var];
QStringList t;
- QMap<QString,QStringList>::const_iterator it = stringListValueMap.constFind(var);
- if (it != stringListValueMap.constEnd()) {
- const QStringList& sl = it.value();
+ QStringListPairMap::const_iterator it = stringListPairMap.constFind(var);
+ if (it != stringListPairMap.constEnd()) {
+ const QStringList& sl = it.value().second;
if (!sl.isEmpty()) {
t.reserve(sl.size());
for (int i=0; i<sl.size(); ++i) {
@@ -361,7 +386,7 @@ QStringList Config::getCanonicalRelativePathList(const QString& var) const
First, this function looks up the configuration variable \a var
in the location map and, if found, sets the internal variable
- \c{lastLoc} the Location that \a var maps to.
+ \c{lastLocation_} the Location that \a var maps to.
Then it looks up the configuration variable \a var in the string
list map, which maps to a string list that contains file paths.
@@ -371,11 +396,11 @@ QStringList Config::getCanonicalRelativePathList(const QString& var) const
QStringList Config::getCleanPathList(const QString& var) const
{
if (!locMap[var].isEmpty())
- (Location&) lastLoc = locMap[var];
+ (Location&) lastLocation_ = locMap[var];
QStringList t;
- QMap<QString,QStringList>::const_iterator it = stringListValueMap.constFind(var);
- if (it != stringListValueMap.constEnd()) {
- const QStringList& sl = it.value();
+ QStringListPairMap::const_iterator it = stringListPairMap.constFind(var);
+ if (it != stringListPairMap.constEnd()) {
+ const QStringList& sl = it.value().second;
if (!sl.isEmpty()) {
t.reserve(sl.size());
for (int i=0; i<sl.size(); ++i) {
@@ -387,6 +412,47 @@ QStringList Config::getCleanPathList(const QString& var) const
}
/*!
+ This function should only be called when the configuration
+ variable \a var maps to a string list that contains file paths.
+ It cleans the paths with QDir::cleanPath() before returning
+ them.
+
+ First, this function looks up the configuration variable \a var
+ in the location map and, if found, sets the internal variable
+ \c{lastLocation_} the Location that \a var maps to.
+
+ Then it looks up the configuration variable \a var in the string
+ list map, which maps to a string list that contains file paths.
+ These paths might not be clean, so QDir::cleanPath() is called
+ for each one. The string list returned contains cleaned paths.
+ */
+QStringList Config::getPathList(const QString& var) const
+{
+ if (!locMap[var].isEmpty())
+ (Location&) lastLocation_ = locMap[var];
+ QStringList t;
+ QStringListPairMap::const_iterator it = stringListPairMap.constFind(var);
+ if (it != stringListPairMap.constEnd()) {
+ const QStringList& sl = it.value().second;
+ const QString d = it.value().first;
+ if (!sl.isEmpty()) {
+ t.reserve(sl.size());
+ for (int i=0; i<sl.size(); ++i) {
+ QFileInfo fileInfo;
+ QString path = d + "/" + QDir::cleanPath(sl[i]);
+ fileInfo.setFile(path);
+ if (!fileInfo.exists())
+ lastLocation_.warning(tr("File '%1' does not exist").arg(path));
+ else
+ t.append(path);
+ }
+ }
+ }
+ return t;
+}
+
+
+/*!
Calls getRegExpList() with the control variable \a var and
iterates through the resulting list of regular expressions,
concatening them with some extras characters to form a single
@@ -441,8 +507,8 @@ QSet<QString> Config::subVars(const QString& var) const
{
QSet<QString> result;
QString varDot = var + QLatin1Char('.');
- QStringMultiMap::ConstIterator v = stringValueMap.constBegin();
- while (v != stringValueMap.constEnd()) {
+ QStringPairMap::ConstIterator v = stringPairMap.constBegin();
+ while (v != stringPairMap.constEnd()) {
if (v.key().startsWith(varDot)) {
QString subVar = v.key().mid(varDot.length());
int dot = subVar.indexOf(QLatin1Char('.'));
@@ -460,11 +526,11 @@ QSet<QString> Config::subVars(const QString& var) const
with the matching keys (stripped of the prefix \a var and
mapped to their values. The pairs are inserted into \a t
*/
-void Config::subVarsAndValues(const QString& var, QStringMultiMap& t) const
+void Config::subVarsAndValues(const QString& var, QStringPairMap& t) const
{
QString varDot = var + QLatin1Char('.');
- QStringMultiMap::ConstIterator v = stringValueMap.constBegin();
- while (v != stringValueMap.constEnd()) {
+ QStringPairMap::ConstIterator v = stringPairMap.constBegin();
+ while (v != stringPairMap.constEnd()) {
if (v.key().startsWith(varDot)) {
QString subVar = v.key().mid(varDot.length());
int dot = subVar.indexOf(QLatin1Char('.'));
@@ -629,10 +695,10 @@ QString Config::findFile(const Location& location,
/*!
Copies the \a sourceFilePath to the file name constructed by
- concatenating \a targetDirPath and \a userFriendlySourceFilePath.
- \a location is for identifying the file and line number where
- a qdoc error occurred. The constructed output file name is
- returned.
+ concatenating \a targetDirPath and the file name from the
+ \a userFriendlySourceFilePath. \a location is for identifying
+ the file and line number where a qdoc error occurred. The
+ constructed output file name is returned.
*/
QString Config::copyFile(const Location& location,
const QString& sourceFilePath,
@@ -641,8 +707,8 @@ QString Config::copyFile(const Location& location,
{
QFile inFile(sourceFilePath);
if (!inFile.open(QFile::ReadOnly)) {
- location.fatal(tr("Cannot open input file '%1': %2")
- .arg(sourceFilePath).arg(inFile.errorString()));
+ location.warning(tr("Cannot open input file for copy: '%1': %2")
+ .arg(sourceFilePath).arg(inFile.errorString()));
return QString();
}
@@ -650,11 +716,14 @@ QString Config::copyFile(const Location& location,
int slash = outFileName.lastIndexOf(QLatin1Char('/'));
if (slash != -1)
outFileName = outFileName.mid(slash);
-
- QFile outFile(targetDirPath + QLatin1Char('/') + outFileName);
+ if ((outFileName.size()) > 0 && (outFileName[0] != '/'))
+ outFileName = targetDirPath + QLatin1Char('/') + outFileName;
+ else
+ outFileName = targetDirPath + outFileName;
+ QFile outFile(outFileName);
if (!outFile.open(QFile::WriteOnly)) {
- location.fatal(tr("Cannot open output file '%1': %2")
- .arg(outFile.fileName()).arg(outFile.errorString()));
+ location.warning(tr("Cannot open output file for copy: '%1': %2")
+ .arg(outFileName).arg(outFile.errorString()));
return QString();
}
@@ -737,6 +806,8 @@ bool Config::isMetaKeyChar(QChar ch)
*/
void Config::load(Location location, const QString& fileName)
{
+ pushWorkingDir(QFileInfo(fileName).path());
+ QDir::setCurrent(QFileInfo(fileName).path());
QRegExp keySyntax(QLatin1String("\\w+(?:\\.\\w+)*"));
#define SKIP_CHAR() \
@@ -853,9 +924,7 @@ void Config::load(Location location, const QString& fileName)
/*
Here is the recursive call.
*/
- load(location,
- QFileInfo(QFileInfo(fileName).dir(), includeFile)
- .filePath());
+ load(location, QFileInfo(QFileInfo(fileName).dir(), includeFile).filePath());
}
else {
/*
@@ -961,29 +1030,34 @@ void Config::load(Location location, const QString& fileName)
else {
locMap[*key].setEtc(true);
}
- if (stringValueMap[*key].isEmpty()) {
- stringValueMap[*key] = stringValue;
+ if (stringPairMap[*key].second.isEmpty()) {
+ stringPairMap[*key].first = QDir::currentPath();
+ stringPairMap[*key].second = stringValue;
}
else {
- stringValueMap[*key] +=
- QLatin1Char(' ') + stringValue;
+ stringPairMap[*key].second += QLatin1Char(' ') + stringValue;
}
- stringListValueMap[*key] += stringListValue;
+ stringListPairMap[*key].first = QDir::currentPath();
+ stringListPairMap[*key].second += stringListValue;
}
else {
locMap[*key] = keyLoc;
- stringValueMap[*key] = stringValue;
- stringListValueMap[*key] = stringListValue;
+ stringPairMap[*key].first = QDir::currentPath();
+ stringPairMap[*key].second = stringValue;
+ stringListPairMap[*key].first = QDir::currentPath();
+ stringListPairMap[*key].second = stringListValue;
}
++key;
}
}
}
else {
- location.fatal(tr("Unexpected character '%1' at beginning of line")
- .arg(c));
+ location.fatal(tr("Unexpected character '%1' at beginning of line").arg(c));
}
}
+ popWorkingDir();
+ if (!workingDirs_.isEmpty())
+ QDir::setCurrent(QFileInfo(workingDirs_.top()).path());
}
QStringList Config::getFilesHere(const QString& uncleanDir,
@@ -1029,4 +1103,25 @@ QStringList Config::getFilesHere(const QString& uncleanDir,
return result;
}
+/*!
+ Push \a dir onto the stack of working directories.
+ */
+void Config::pushWorkingDir(const QString& dir)
+{
+ workingDirs_.push(dir);
+}
+
+/*!
+ If the stack of working directories is not empty, pop the
+ top entry and return it. Otherwise return an empty string.
+ */
+QString Config::popWorkingDir()
+{
+ if (!workingDirs_.isEmpty()) {
+ return workingDirs_.pop();
+ }
+ qDebug() << "RETURNED EMPTY WORKING DIR";
+ return QString();
+}
+
QT_END_NAMESPACE
diff --git a/src/tools/qdoc/config.h b/src/tools/qdoc/config.h
index b3a35b9c0f..f5c1999159 100644
--- a/src/tools/qdoc/config.h
+++ b/src/tools/qdoc/config.h
@@ -49,12 +49,26 @@
#include <qmap.h>
#include <qset.h>
#include <qstringlist.h>
-
+#include <qstack.h>
+#include <qpair.h>
#include "location.h"
QT_BEGIN_NAMESPACE
-typedef QMultiMap<QString, QString> QStringMultiMap;
+/*
+ In QStringPair, the first string is the path to a directory;
+ the second string is some value.
+ */
+typedef QPair<QString, QString> QStringPair;
+
+/*
+ In QStringListPair, the first string is the path to a directory;
+ the string list is a list of string values.
+ */
+typedef QPair<QString, QStringList> QStringListPair;
+typedef QMultiMap<QString, QStringPair> QStringPairMultiMap;
+typedef QMap<QString, QStringPair> QStringPairMap;
+typedef QMap<QString, QStringListPair> QStringListPairMap;
class Config
{
@@ -68,20 +82,22 @@ public:
const QString& programName() const { return prog; }
const Location& location() const { return loc; }
- const Location& lastLocation() const { return lastLoc; }
+ const Location& lastLocation() const { return lastLocation_; }
bool getBool(const QString& var) const;
int getInt(const QString& var) const;
QString getOutputDir() const;
QSet<QString> getOutputFormats() const;
QString getString(const QString& var) const;
+ QString getPath(const QString& var) const;
QSet<QString> getStringSet(const QString& var) const;
QStringList getStringList(const QString& var) const;
QStringList getCanonicalRelativePathList(const QString& var) const;
QStringList getCleanPathList(const QString& var) const;
+ QStringList getPathList(const QString& var) const;
QRegExp getRegExp(const QString& var) const;
QList<QRegExp> getRegExpList(const QString& var) const;
QSet<QString> subVars(const QString& var) const;
- void subVarsAndValues(const QString& var, QStringMultiMap& t) const;
+ void subVarsAndValues(const QString& var, QStringPairMap& t) const;
QStringList getAllFiles(const QString& filesVar,
const QString& dirsVar,
const QSet<QString> &excludedDirs = QSet<QString>(),
@@ -111,6 +127,8 @@ public:
const QString& targetDirPath);
static int numParams(const QString& value);
static bool removeDirContents(const QString& dir);
+ static void pushWorkingDir(const QString& dir);
+ static QString popWorkingDir();
QT_STATIC_CONST QString dot;
@@ -125,14 +143,18 @@ private:
QString prog;
Location loc;
- Location lastLoc;
+ Location lastLocation_;
QMap<QString, Location> locMap;
- QMap<QString, QStringList> stringListValueMap;
QMap<QString, QString> stringValueMap;
+ QMap<QString, QStringList> stringListValueMap;
+
+ QStringPairMap stringPairMap;
+ QStringListPairMap stringListPairMap;
static QMap<QString, QString> uncompressedFiles;
static QMap<QString, QString> extractedDirs;
static int numInstances;
+ static QStack<QString> workingDirs_;
};
#define CONFIG_ALIAS "alias"
diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp
index d4fe0ff5f7..2fc3a6c477 100644
--- a/src/tools/qdoc/cppcodeparser.cpp
+++ b/src/tools/qdoc/cppcodeparser.cpp
@@ -2156,8 +2156,8 @@ bool CppCodeParser::matchDocsAndStuff()
while (n != nodes.end()) {
processOtherMetaCommands(*d, *n);
(*n)->setDoc(*d);
- if ((*n)->isInnerNode() &&
- ((InnerNode *)*n)->includes().isEmpty()) {
+ checkModuleInclusion(*n);
+ if ((*n)->isInnerNode() && ((InnerNode *)*n)->includes().isEmpty()) {
InnerNode *m = static_cast<InnerNode *>(*n);
while (m->parent() != qdb_->treeRoot())
m = m->parent();
diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp
index 563df612ab..3b7a4d09cc 100644
--- a/src/tools/qdoc/ditaxmlgenerator.cpp
+++ b/src/tools/qdoc/ditaxmlgenerator.cpp
@@ -573,7 +573,8 @@ void DitaXmlGenerator::initializeGenerator(const Config &config)
customHeadElements = config.getStringList(DitaXmlGenerator::format() +
Config::dot +
DITAXMLGENERATOR_CUSTOMHEADELEMENTS);
- codeIndent = config.getInt(CONFIG_CODEINDENT);
+ // The following line was changed to fix QTBUG-27798
+ //codeIndent = config.getInt(CONFIG_CODEINDENT);
version = config.getString(CONFIG_VERSION);
vrm = version.split(QLatin1Char('.'));
}
@@ -5883,7 +5884,7 @@ QStringList DitaXmlGenerator::getMetadataElements(const InnerNode* inner,
*/
QString DitaXmlGenerator::metadataDefault(DitaTag t) const
{
- return metadataDefaults.value(ditaTags[t]);
+ return metadataDefaults.value(ditaTags[t]).second;
}
/*!
diff --git a/src/tools/qdoc/ditaxmlgenerator.h b/src/tools/qdoc/ditaxmlgenerator.h
index 7e1f5a0d5c..3f87fae8a9 100644
--- a/src/tools/qdoc/ditaxmlgenerator.h
+++ b/src/tools/qdoc/ditaxmlgenerator.h
@@ -513,7 +513,7 @@ private:
static QString ditaTags[];
QStack<QXmlStreamWriter*> xmlWriterStack;
QStack<DitaTag> tagStack;
- QStringMultiMap metadataDefaults;
+ QStringPairMap metadataDefaults;
QVector<NodeMultiMap*> nodeTypeMaps;
QVector<NodeMultiMap*> nodeSubtypeMaps;
QVector<NodeMultiMap*> pageTypeMaps;
diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp
index c6db340f74..2854aedbbe 100644
--- a/src/tools/qdoc/generator.cpp
+++ b/src/tools/qdoc/generator.cpp
@@ -697,12 +697,14 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
if (!best.isEmpty() && !documentedItems.contains(best))
details = tr("Maybe you meant '%1'?").arg(best);
- node->doc().location().warning(tr("No such enum item '%1' in %2").arg(*a).arg(node->plainFullName()), details);
+ node->doc().location().warning(tr("No such enum item '%1' in %2")
+ .arg(*a).arg(node->plainFullName()), details);
if (*a == "Void")
qDebug() << "VOID:" << node->name() << definedItems;
}
else if (!documentedItems.contains(*a)) {
- node->doc().location().warning(tr("Undocumented enum item '%1' in %2").arg(*a).arg(node->plainFullName()));
+ node->doc().location().warning(tr("Undocumented enum item '%1' in %2")
+ .arg(*a).arg(node->plainFullName()));
}
++a;
}
@@ -1484,22 +1486,24 @@ void Generator::initialize(const Config &config)
QDir dirInfo;
if (dirInfo.exists(outDir_)) {
- if (!Config::removeDirContents(outDir_))
- config.lastLocation().error(tr("Cannot empty output directory '%1'").arg(outDir_));
+ if (!runGenerateOnly()) {
+ if (!Config::removeDirContents(outDir_))
+ config.lastLocation().error(tr("Cannot empty output directory '%1'").arg(outDir_));
+ }
}
else {
if (!dirInfo.mkpath(outDir_))
config.lastLocation().fatal(tr("Cannot create output directory '%1'").arg(outDir_));
}
- if (!dirInfo.mkdir(outDir_ + "/images"))
- config.lastLocation().fatal(tr("Cannot create output directory '%1'").arg(outDir_ + "/images"));
- if (!dirInfo.mkdir(outDir_ + "/images/used-in-examples"))
- config.lastLocation().fatal(tr("Cannot create output directory '%1'").arg(outDir_ + "/images/used-in-examples"));
- if (!dirInfo.mkdir(outDir_ + "/scripts"))
- config.lastLocation().fatal(tr("Cannot create output directory '%1'").arg(outDir_ + "/scripts"));
- if (!dirInfo.mkdir(outDir_ + "/style"))
- config.lastLocation().fatal(tr("Cannot create output directory '%1'").arg(outDir_ + "/style"));
+ if (!dirInfo.exists(outDir_ + "/images") && !dirInfo.mkdir(outDir_ + "/images"))
+ config.lastLocation().fatal(tr("Cannot create images directory '%1'").arg(outDir_ + "/images"));
+ if (!dirInfo.exists(outDir_ + "/images/used-in-examples") && !dirInfo.mkdir(outDir_ + "/images/used-in-examples"))
+ config.lastLocation().fatal(tr("Cannot create images used in examples directory '%1'").arg(outDir_ + "/images/used-in-examples"));
+ if (!dirInfo.exists(outDir_ + "/scripts") && !dirInfo.mkdir(outDir_ + "/scripts"))
+ config.lastLocation().fatal(tr("Cannot create scripts directory '%1'").arg(outDir_ + "/scripts"));
+ if (!dirInfo.exists(outDir_ + "/style") && !dirInfo.mkdir(outDir_ + "/style"))
+ config.lastLocation().fatal(tr("Cannot create style directory '%1'").arg(outDir_ + "/style"));
}
imageFiles = config.getCleanPathList(CONFIG_IMAGES);
@@ -1524,75 +1528,37 @@ void Generator::initialize(const Config &config)
if (outputFormats.contains((*g)->format())) {
currentGenerator_ = (*g);
(*g)->initializeGenerator(config);
- QStringList extraImages = config.getCleanPathList(CONFIG_EXTRAIMAGES+Config::dot+(*g)->format());
+ QStringList extraImages = config.getCleanPathList((*g)->format() +
+ Config::dot +
+ CONFIG_EXTRAIMAGES);
QStringList::ConstIterator e = extraImages.constBegin();
while (e != extraImages.constEnd()) {
- QString userFriendlyFilePath;
- QString filePath = Config::findFile(config.lastLocation(),
- imageFiles,
- imageDirs,
- *e,
- imgFileExts[(*g)->format()],
- userFriendlyFilePath);
+ QString filePath = *e;
if (!filePath.isEmpty())
- Config::copyFile(config.lastLocation(),
- filePath,
- userFriendlyFilePath,
- (*g)->outputDir() +
- "/images");
+ Config::copyFile(config.lastLocation(), filePath, filePath,
+ (*g)->outputDir() + "/images");
++e;
}
// Documentation template handling
- QString templateDir = config.getString((*g)->format() + Config::dot + CONFIG_TEMPLATEDIR);
-
- QStringList searchDirs;
- if (!templateDir.isEmpty()) {
- searchDirs.append(templateDir);
- }
- if (!Config::installDir.isEmpty()) {
- searchDirs.append(Config::installDir);
+ QStringList scripts = config.getPathList((*g)->format()+Config::dot+CONFIG_SCRIPTS);
+ e = scripts.constBegin();
+ while (e != scripts.constEnd()) {
+ QString filePath = *e;
+ if (!filePath.isEmpty())
+ Config::copyFile(config.lastLocation(), filePath, filePath,
+ (*g)->outputDir() + "/scripts");
+ ++e;
}
- if (!searchDirs.isEmpty()) {
- QStringList noExts;
- QStringList scripts = config.getCleanPathList((*g)->format()+Config::dot+CONFIG_SCRIPTS);
- e = scripts.constBegin();
- while (e != scripts.constEnd()) {
- QString userFriendlyFilePath;
- QString filePath = Config::findFile(config.lastLocation(),
- scriptFiles,
- searchDirs,
- *e,
- noExts,
- userFriendlyFilePath);
- if (!filePath.isEmpty())
- Config::copyFile(config.lastLocation(),
- filePath,
- userFriendlyFilePath,
- (*g)->outputDir() +
- "/scripts");
- ++e;
- }
-
- QStringList styles = config.getCleanPathList((*g)->format()+Config::dot+CONFIG_STYLESHEETS);
- e = styles.constBegin();
- while (e != styles.constEnd()) {
- QString userFriendlyFilePath;
- QString filePath = Config::findFile(config.lastLocation(),
- styleFiles,
- searchDirs,
- *e,
- noExts,
- userFriendlyFilePath);
- if (!filePath.isEmpty())
- Config::copyFile(config.lastLocation(),
- filePath,
- userFriendlyFilePath,
- (*g)->outputDir() +
- "/style");
- ++e;
- }
+ QStringList styles = config.getPathList((*g)->format()+Config::dot+CONFIG_STYLESHEETS);
+ e = styles.constBegin();
+ while (e != styles.constEnd()) {
+ QString filePath = *e;
+ if (!filePath.isEmpty())
+ Config::copyFile(config.lastLocation(), filePath, filePath,
+ (*g)->outputDir() + "/style");
+ ++e;
}
}
++g;
diff --git a/src/tools/qdoc/generator.h b/src/tools/qdoc/generator.h
index 3dc3b84767..8997ef0628 100644
--- a/src/tools/qdoc/generator.h
+++ b/src/tools/qdoc/generator.h
@@ -95,6 +95,7 @@ public:
static void setQDocPass(Passes pass) { qdocPass_ = pass; }
static bool runPrepareOnly() { return (qdocPass_ == Prepare); }
static bool runGenerateOnly() { return (qdocPass_ == Generate); }
+ static QString defaultModuleName() { return project; }
protected:
virtual void beginSubPage(const InnerNode* node, const QString& fileName);
diff --git a/src/tools/qdoc/helpprojectwriter.cpp b/src/tools/qdoc/helpprojectwriter.cpp
index 15698713ae..43a781f972 100644
--- a/src/tools/qdoc/helpprojectwriter.cpp
+++ b/src/tools/qdoc/helpprojectwriter.cpp
@@ -83,6 +83,7 @@ HelpProjectWriter::HelpProjectWriter(const Config &config,
if (project.fileName.isEmpty())
project.fileName = defaultFileName;
project.extraFiles = config.getStringSet(prefix + "extraFiles");
+ project.extraFiles += config.getStringSet(CONFIG_QHP + Config::dot + "extraFiles");
project.indexTitle = config.getString(prefix + "indexTitle");
project.indexRoot = config.getString(prefix + "indexRoot");
project.filterAttributes = config.getStringList(prefix + "filterAttributes").toSet();
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp
index 17dc40f08a..d48c706707 100644
--- a/src/tools/qdoc/htmlgenerator.cpp
+++ b/src/tools/qdoc/htmlgenerator.cpp
@@ -94,7 +94,8 @@ static void addLink(const QString &linkTarget,
Constructs the HTML output generator.
*/
HtmlGenerator::HtmlGenerator()
- : helpProjectWriter(0),
+ : codeIndent(0),
+ helpProjectWriter(0),
inObsoleteLink(false),
funcLeftParen("\\S(\\()"),
obsoleteLinks(false)
@@ -210,7 +211,8 @@ void HtmlGenerator::initializeGenerator(const Config &config)
++edition;
}
- codeIndent = config.getInt(CONFIG_CODEINDENT);
+ // The following line was changed to fix QTBUG-27798
+ //codeIndent = config.getInt(CONFIG_CODEINDENT);
helpProjectWriter = new HelpProjectWriter(config, project.toLower() + ".qhp", this);
diff --git a/src/tools/qdoc/location.cpp b/src/tools/qdoc/location.cpp
index ceb5709aae..ca6521c002 100644
--- a/src/tools/qdoc/location.cpp
+++ b/src/tools/qdoc/location.cpp
@@ -42,7 +42,7 @@
#include <qdebug.h>
#include "config.h"
#include "location.h"
-
+#include "generator.h"
#include <qdir.h>
#include <qregexp.h>
#include <stdlib.h>
@@ -57,6 +57,7 @@ QT_STATIC_CONST_IMPL Location Location::null;
int Location::tabSize;
QString Location::programName;
QRegExp *Location::spuriousRegExp = 0;
+bool Location::logProgress_ = false;
/*!
\class Location
@@ -260,25 +261,30 @@ QString Location::canonicalRelativePath(const QString &path) const
/*!
Writes \a message and \a detals to stderr as a formatted
- warning message.
+ warning message. Does not write the message if qdoc is in
+ the Prepare phase.
*/
void Location::warning(const QString& message, const QString& details) const
{
- emitMessage(Warning, message, details);
+ if (!Generator::runPrepareOnly())
+ emitMessage(Warning, message, details);
}
/*!
Writes \a message and \a detals to stderr as a formatted
- error message.
+ error message. Does not write the message if qdoc is in
+ the Prepare phase.
*/
void Location::error(const QString& message, const QString& details) const
{
- emitMessage(Error, message, details);
+ if (!Generator::runPrepareOnly())
+ emitMessage(Error, message, details);
}
/*!
Writes \a message and \a detals to stderr as a formatted
- error message and then exits the program.
+ error message and then exits the program. qdoc prints fatal
+ errors in either phase (Prepare or Generate).
*/
void Location::fatal(const QString& message, const QString& details) const
{
@@ -331,6 +337,18 @@ void Location::information(const QString& message)
}
/*!
+ Prints \a message to \c stderr followed by a \c{'\n'},
+ but only if the -log-progress option is set.
+ */
+void Location::logToStdErr(const QString& message)
+{
+ if (logProgress_) {
+ fprintf(stderr, "LOG: %s\n", message.toLatin1().data());
+ fflush(stderr);
+ }
+}
+
+/*!
Report a program bug, including the \a hint.
*/
void Location::internalError(const QString& hint)
diff --git a/src/tools/qdoc/location.h b/src/tools/qdoc/location.h
index d2c9487968..0d22e94b46 100644
--- a/src/tools/qdoc/location.h
+++ b/src/tools/qdoc/location.h
@@ -96,6 +96,9 @@ public:
static void terminate();
static void information(const QString& message);
static void internalError(const QString& hint);
+ static void logToStdErr(const QString& message);
+ static void startLoggingProgress() { logProgress_ = true; }
+ static void stopLoggingProgress() { logProgress_ = false; }
private:
enum MessageType { Warning, Error };
@@ -123,6 +126,7 @@ private:
static int tabSize;
static QString programName;
static QRegExp *spuriousRegExp;
+ static bool logProgress_;
};
QT_END_NAMESPACE
diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp
index 5fbc01f1f0..064617e6f4 100644
--- a/src/tools/qdoc/main.cpp
+++ b/src/tools/qdoc/main.cpp
@@ -101,6 +101,9 @@ static bool obsoleteLinks = false;
static QStringList defines;
static QStringList dependModules;
static QStringList indexDirs;
+static QString currentDir;
+static QString prevCurrentDir;
+static QString documentationPath;
/*!
Print the help message to \c stdout.
@@ -118,7 +121,7 @@ static void printHelp()
" -highlighting "
"Turn on syntax highlighting (makes qdoc run slower)\n"
" -indexdir "
- "Specify a directory where QDoc should search for indices to link to\n"
+ "Specify a directory where QDoc should search for index files to load\n"
" -installdir "
"Specify the directory where the output will be after running \"make install\"\n"
" -no-examples "
@@ -150,6 +153,88 @@ static void printVersion()
Location::information(s);
}
+static void loadIndexFiles(Config& config)
+{
+ QDocDatabase* qdb = QDocDatabase::qdocDB();
+ /*
+ Read some XML indexes containing definitions from other documentation sets.
+ */
+ QStringList indexFiles = config.getStringList(CONFIG_INDEXES);
+
+ dependModules += config.getStringList(CONFIG_DEPENDS);
+
+ // Allow modules and third-party application/libraries to link
+ // to the Qt docs without having to explicitly pass --indexdir.
+ if (!indexDirs.contains(documentationPath))
+ indexDirs.append(documentationPath);
+
+ if (dependModules.size() > 0) {
+ if (indexDirs.size() > 0) {
+ for (int i = 0; i < indexDirs.size(); i++) {
+ if (indexDirs[i].startsWith("..")) {
+ const QString prefix(QDir(currentDir).relativeFilePath(prevCurrentDir));
+ if (!prefix.isEmpty())
+ indexDirs[i].prepend(prefix + QLatin1Char('/'));
+ }
+ }
+ /*
+ Add all subdirectories of the indexdirs as dependModules,
+ when an asterisk is used in the 'depends' list.
+ */
+ if (dependModules.contains("*")) {
+ dependModules.removeOne("*");
+ for (int i = 0; i < indexDirs.size(); i++) {
+ QDir scanDir = QDir(indexDirs[i]);
+ scanDir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
+ QFileInfoList dirList = scanDir.entryInfoList();
+ for (int j = 0; j < dirList.size(); j++) {
+ if (dirList[j].fileName().toLower() != config.getString(CONFIG_PROJECT).toLower())
+ dependModules.append(dirList[j].fileName());
+ }
+ }
+ }
+ for (int i = 0; i < dependModules.size(); i++) {
+ QString indexToAdd;
+ QList<QFileInfo> foundIndices;
+ for (int j = 0; j < indexDirs.size(); j++) {
+ QString fileToLookFor = indexDirs[j] + QLatin1Char('/') + dependModules[i] +
+ QLatin1Char('/') + dependModules[i] + QLatin1String(".index");
+ if (QFile::exists(fileToLookFor)) {
+ QFileInfo tempFileInfo(fileToLookFor);
+ if (!foundIndices.contains(tempFileInfo))
+ foundIndices.append(tempFileInfo);
+ }
+ }
+ qSort(foundIndices.begin(), foundIndices.end(), creationTimeBefore);
+ if (foundIndices.size() > 1) {
+ /*
+ QDoc should always use the last entry in the multimap when there are
+ multiple index files for a module, since the last modified file has the
+ highest UNIX timestamp.
+ */
+ qDebug() << "Multiple indices found for dependency:" << dependModules[i] << "\nFound:";
+ for (int k = 0; k < foundIndices.size(); k++)
+ qDebug() << foundIndices[k].absoluteFilePath();
+ qDebug() << "Using" << foundIndices[foundIndices.size() - 1].absoluteFilePath()
+ << "as index for" << dependModules[i];
+ indexToAdd = foundIndices[foundIndices.size() - 1].absoluteFilePath();
+ }
+ else if (foundIndices.size() == 1) {
+ indexToAdd = foundIndices[0].absoluteFilePath();
+ }
+ if (!indexToAdd.isEmpty() && !indexFiles.contains(indexToAdd))
+ indexFiles << indexToAdd;
+ }
+ }
+ else {
+ qDebug() << "Dependant modules specified, but no index directories or "
+ << "install directory were set."
+ << "There will probably be errors for missing links.";
+ }
+ }
+ qdb->readIndexes(indexFiles);
+}
+
/*!
Processes the qdoc config file \a fileName. This is the
controller for all of qdoc.
@@ -168,8 +253,7 @@ static void processQdocconfFile(const QString &fileName)
Config config(tr("qdoc"));
int i = 0;
while (defaults[i].key) {
- config.setStringList(defaults[i].key,
- QStringList() << defaults[i].value);
+ config.setStringList(defaults[i].key, QStringList() << defaults[i].value);
++i;
}
config.setStringList(CONFIG_SYNTAXHIGHLIGHTING, QStringList(highlighting ? "true" : "false"));
@@ -177,11 +261,16 @@ static void processQdocconfFile(const QString &fileName)
config.setStringList(CONFIG_NOLINKERRORS, QStringList(noLinkErrors ? "true" : "false"));
config.setStringList(CONFIG_OBSOLETELINKS, QStringList(obsoleteLinks ? "true" : "false"));
- QString documentationPath = QLibraryInfo::rawLocation(QLibraryInfo::DocumentationPath,
- QLibraryInfo::EffectivePaths);
-
- // Set a few environment variables that can be used from the qdocconf file
- qputenv("QT_INSTALL_DOCS", documentationPath.toLatin1());
+ /*
+ If QT_INSTALL_DOCS is not set, set it here so it can be used from
+ the qdocconf files.
+ */
+ QString qt_install_docs = qgetenv("QT_INSTALL_DOCS");
+ if (qt_install_docs.isEmpty()) {
+ documentationPath = QLibraryInfo::rawLocation(QLibraryInfo::DocumentationPath,
+ QLibraryInfo::EffectivePaths);
+ qputenv("QT_INSTALL_DOCS", documentationPath.toLatin1());
+ }
/*
With the default configuration values in place, load
@@ -192,6 +281,7 @@ static void processQdocconfFile(const QString &fileName)
in the file being processed, mainly for error reporting
purposes.
*/
+ currentDir = QFileInfo(fileName).path();
Location::initialize(config);
config.load(fileName);
@@ -202,10 +292,18 @@ static void processQdocconfFile(const QString &fileName)
config.setStringList(CONFIG_DEFINES,defs);
Location::terminate();
- QString prevCurrentDir = QDir::currentPath();
- QString dir = QFileInfo(fileName).path();
- if (!dir.isEmpty())
- QDir::setCurrent(dir);
+ prevCurrentDir = QDir::currentPath();
+ currentDir = QFileInfo(fileName).path();
+ if (!currentDir.isEmpty())
+ QDir::setCurrent(currentDir);
+
+ QString phase;
+ if (Generator::runPrepareOnly())
+ phase = " in -prepare mode ";
+ else if (Generator::runGenerateOnly())
+ phase = " in -generate mode ";
+ QString msg = "Running qdoc for " + config.getString(CONFIG_PROJECT) + phase;
+ Location::logToStdErr(msg);
/*
Initialize all the classes and data structures with the
@@ -227,8 +325,7 @@ static void processQdocconfFile(const QString &fileName)
while (fn != fileNames.constEnd()) {
QTranslator *translator = new QTranslator(0);
if (!translator->load(*fn))
- config.lastLocation().error(tr("Cannot load translator '%1'")
- .arg(*fn));
+ config.lastLocation().error(tr("Cannot load translator '%1'").arg(*fn));
QCoreApplication::instance()->installTranslator(translator);
translators.append(translator);
++fn;
@@ -260,86 +357,8 @@ static void processQdocconfFile(const QString &fileName)
QSet<QString> outputFormats = config.getOutputFormats();
Location outputFormatsLocation = config.lastLocation();
- /*
- Read some XML indexes containing definitions from other documentation sets.
- */
- QStringList indexFiles = config.getStringList(CONFIG_INDEXES);
-
- dependModules += config.getStringList(CONFIG_DEPENDS);
-
- // Allow modules and third-party application/libraries to link
- // to the Qt docs without having to explicitly pass --indexdir.
- if (!indexDirs.contains(documentationPath))
- indexDirs.append(documentationPath);
-
- if (dependModules.size() > 0) {
- if (indexDirs.size() > 0) {
- for (int i = 0; i < indexDirs.size(); i++) {
- if (indexDirs[i].startsWith("..")) {
- const QString prefix(QDir(dir).relativeFilePath(prevCurrentDir));
- if (!prefix.isEmpty())
- indexDirs[i].prepend(prefix + QLatin1Char('/'));
- }
- }
- /*
- Add all subdirectories of the indexdirs as dependModules when an asterisk is used in
- the 'depends' list.
- */
- if (dependModules.contains("*")) {
- dependModules.removeOne("*");
- for (int i = 0; i < indexDirs.size(); i++) {
- QDir scanDir = QDir(indexDirs[i]);
- scanDir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
- QFileInfoList dirList = scanDir.entryInfoList();
- for (int j = 0; j < dirList.size(); j++) {
- if (dirList[j].fileName().toLower() != config.getString(CONFIG_PROJECT).toLower())
- dependModules.append(dirList[j].fileName());
- }
- }
- }
- for (int i = 0; i < dependModules.size(); i++) {
- QString indexToAdd;
- QList<QFileInfo> foundIndices;
- for (int j = 0; j < indexDirs.size(); j++) {
- QString fileToLookFor = indexDirs[j] + QLatin1Char('/') + dependModules[i] +
- QLatin1Char('/') + dependModules[i] + QLatin1String(".index");
- if (QFile::exists(fileToLookFor)) {
- QFileInfo tempFileInfo(fileToLookFor);
- if (!foundIndices.contains(tempFileInfo))
- foundIndices.append(tempFileInfo);
- }
- }
- qSort(foundIndices.begin(), foundIndices.end(), creationTimeBefore);
- if (foundIndices.size() > 1) {
- /*
- QDoc should always use the last entry in the multimap when there are
- multiple index files for a module, since the last modified file has the
- highest UNIX timestamp.
- */
- qDebug() << "Multiple indices found for dependency:" << dependModules[i] << "\nFound:";
- for (int k = 0; k < foundIndices.size(); k++)
- qDebug() << foundIndices[k].absoluteFilePath();
- qDebug() << "Using" << foundIndices[foundIndices.size() - 1].absoluteFilePath()
- << "as index for" << dependModules[i];
- indexToAdd = foundIndices[foundIndices.size() - 1].absoluteFilePath();
- }
- else if (foundIndices.size() == 1) {
- indexToAdd = foundIndices[0].absoluteFilePath();
- }
- else {
- qDebug() << "No indices for" << dependModules[i] <<
- "could be found in the specified index directories.";
- }
- if (!indexToAdd.isEmpty() && !indexFiles.contains(indexToAdd))
- indexFiles << indexToAdd;
- }
- }
- else {
- qDebug() << "Dependant modules specified, but no index directories or install directory were set."
- << "There will probably be errors for missing links.";
- }
- }
- qdb->readIndexes(indexFiles);
+ if (!Generator::runPrepareOnly())
+ loadIndexFiles(config);
QSet<QString> excludedDirs;
QSet<QString> excludedFiles;
@@ -604,6 +623,9 @@ int main(int argc, char **argv)
else if (opt == "-generate") {
Generator::setQDocPass(Generator::Generate);
}
+ else if (opt == "-log-progress") {
+ Location::startLoggingProgress();
+ }
else {
qdocFiles.append(opt);
}
diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp
index 67805d3dff..3828709b7f 100644
--- a/src/tools/qdoc/node.cpp
+++ b/src/tools/qdoc/node.cpp
@@ -462,7 +462,7 @@ void Node::setLink(LinkType linkType, const QString &link, const QString &desc)
*/
void Node::setSince(const QString &since)
{
- sinc = since.simplified();
+ since_ = since.simplified();
}
/*!
diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h
index 451b666a78..05133cab0c 100644
--- a/src/tools/qdoc/node.h
+++ b/src/tools/qdoc/node.h
@@ -222,7 +222,7 @@ public:
Status inheritedStatus() const;
ThreadSafeness threadSafeness() const;
ThreadSafeness inheritedThreadSafeness() const;
- QString since() const { return sinc; }
+ QString since() const { return since_; }
QString templateStuff() const { return templateStuff_; }
PageType pageType() const { return pageType_; }
QString pageTypeString() const;
@@ -280,7 +280,7 @@ private:
QMap<LinkType, QPair<QString, QString> > linkMap_;
QString moduleName_;
QString url_;
- QString sinc;
+ QString since_;
QString templateStuff_;
mutable QString uuid_;
QString outSubDir_;
diff --git a/src/tools/qdoc/puredocparser.cpp b/src/tools/qdoc/puredocparser.cpp
index cd726c3497..9f76596e46 100644
--- a/src/tools/qdoc/puredocparser.cpp
+++ b/src/tools/qdoc/puredocparser.cpp
@@ -195,6 +195,7 @@ bool PureDocParser::processQdocComments()
while (n != nodes.end()) {
processOtherMetaCommands(*d, *n);
(*n)->setDoc(*d);
+ checkModuleInclusion(*n);
if ((*n)->isInnerNode() && ((InnerNode *)*n)->includes().isEmpty()) {
InnerNode *m = static_cast<InnerNode *>(*n);
while (m->parent() && m->parent() != treeRoot)
diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp
index 0c0b30e8c7..d5dbb84386 100644
--- a/src/tools/qdoc/qdocdatabase.cpp
+++ b/src/tools/qdoc/qdocdatabase.cpp
@@ -321,7 +321,7 @@ void QDocDatabase::findAllClasses(const InnerNode* node)
{
NodeList::const_iterator c = node->childNodes().constBegin();
while (c != node->childNodes().constEnd()) {
- if ((*c)->access() != Node::Private && (*c)->url().isEmpty()) {
+ if ((*c)->access() != Node::Private) {
if ((*c)->type() == Node::Class && !(*c)->doc().isEmpty()) {
QString className = (*c)->name();
if ((*c)->parent() &&
@@ -344,8 +344,9 @@ void QDocDatabase::findAllClasses(const InnerNode* node)
}
QString serviceName = (static_cast<const ClassNode *>(*c))->serviceName();
- if (!serviceName.isEmpty())
+ if (!serviceName.isEmpty()) {
serviceClasses_.insert(serviceName, *c);
+ }
}
else if ((*c)->type() == Node::Document &&
(*c)->subType() == Node::QmlClass &&
@@ -372,7 +373,7 @@ void QDocDatabase::findAllFunctions(const InnerNode* node)
NodeList::ConstIterator c = node->childNodes().constBegin();
while (c != node->childNodes().constEnd()) {
if ((*c)->access() != Node::Private) {
- if ((*c)->isInnerNode() && (*c)->url().isEmpty()) {
+ if ((*c)->isInnerNode()) {
findAllFunctions(static_cast<const InnerNode*>(*c));
}
else if ((*c)->type() == Node::Function) {
@@ -415,15 +416,13 @@ void QDocDatabase::findAllNamespaces(const InnerNode* node)
NodeList::ConstIterator c = node->childNodes().constBegin();
while (c != node->childNodes().constEnd()) {
if ((*c)->access() != Node::Private) {
- if ((*c)->isInnerNode() && (*c)->url().isEmpty()) {
+ if ((*c)->isInnerNode()) {
findAllNamespaces(static_cast<const InnerNode *>(*c));
if ((*c)->type() == Node::Namespace) {
- const NamespaceNode* nspace = static_cast<const NamespaceNode *>(*c);
// Ensure that the namespace's name is not empty (the root
// namespace has no name).
- if (!nspace->name().isEmpty()) {
- namespaceIndex_.insert(nspace->name(), *c);
- }
+ if (!(*c)->name().isEmpty())
+ namespaceIndex_.insert((*c)->name(), *c);
}
}
}
@@ -467,12 +466,11 @@ void QDocDatabase::findAllSince(const InnerNode* node)
nsmap.value().insert(func->name(),(*child));
}
}
- else if ((*child)->url().isEmpty()) {
- if ((*child)->type() == Node::Class && !(*child)->doc().isEmpty()) {
+ else {
+ if ((*child)->type() == Node::Class) {
// Insert classes into the since and class maps.
QString className = (*child)->name();
- if ((*child)->parent() && (*child)->parent()->type() == Node::Namespace &&
- !(*child)->parent()->name().isEmpty()) {
+ if ((*child)->parent() && !(*child)->parent()->name().isEmpty()) {
className = (*child)->parent()->name()+"::"+className;
}
nsmap.value().insert(className,(*child));
@@ -481,8 +479,7 @@ void QDocDatabase::findAllSince(const InnerNode* node)
else if ((*child)->subType() == Node::QmlClass) {
// Insert QML elements into the since and element maps.
QString className = (*child)->name();
- if ((*child)->parent() && (*child)->parent()->type() == Node::Namespace &&
- !(*child)->parent()->name().isEmpty()) {
+ if ((*child)->parent() && !(*child)->parent()->name().isEmpty()) {
className = (*child)->parent()->name()+"::"+className;
}
nsmap.value().insert(className,(*child));
@@ -493,17 +490,15 @@ void QDocDatabase::findAllSince(const InnerNode* node)
QString propertyName = (*child)->name();
nsmap.value().insert(propertyName,(*child));
}
- }
- else {
- // Insert external documents into the general since map.
- QString name = (*child)->name();
- if ((*child)->parent() && (*child)->parent()->type() == Node::Namespace &&
- !(*child)->parent()->name().isEmpty()) {
- name = (*child)->parent()->name()+"::"+name;
+ else {
+ // Insert external documents into the general since map.
+ QString name = (*child)->name();
+ if ((*child)->parent() && !(*child)->parent()->name().isEmpty()) {
+ name = (*child)->parent()->name()+"::"+name;
+ }
+ nsmap.value().insert(name,(*child));
}
- nsmap.value().insert(name,(*child));
}
-
// Recursively find child nodes with since commands.
if ((*child)->isInnerNode()) {
findAllSince(static_cast<InnerNode *>(*child));
diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp
index d68fe0e6fa..3f79675b3b 100644
--- a/src/tools/qdoc/qdocindexfiles.cpp
+++ b/src/tools/qdoc/qdocindexfiles.cpp
@@ -48,13 +48,7 @@
#include "location.h"
#include "atom.h"
#include "generator.h"
-
-//include "doc.h"
-//include "htmlgenerator.h"
-//include "node.h"
-//include "text.h"
-//include <limits.h>
-//include <qdebug.h>
+#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -109,8 +103,11 @@ void QDocIndexFiles::destroyQDocIndexFiles()
*/
void QDocIndexFiles::readIndexes(const QStringList& indexFiles)
{
- foreach (const QString& indexFile, indexFiles)
+ foreach (const QString& indexFile, indexFiles) {
+ QString msg = "Loading index file: " + indexFile;
+ Location::logToStdErr(msg);
readIndexFile(indexFile);
+ }
}
/*!
@@ -438,11 +435,18 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
else
section->setStatus(Node::Commendable);
- section->setModuleName(element.attribute("module"));
+ QString moduleName = element.attribute("module");
+ if (!moduleName.isEmpty())
+ section->setModuleName(moduleName);
if (!indexUrl.isEmpty()) {
section->setUrl(indexUrl + QLatin1Char('/') + href);
}
+ QString since = element.attribute("since");
+ if (!since.isEmpty()) {
+ section->setSince(since);
+ }
+
// Create some content for the node.
QSet<QString> emptySet;
Doc doc(location, location, " ", emptySet); // placeholder
@@ -502,7 +506,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
Node* node,
bool generateInternalNodes)
{
- if (!node->url().isEmpty() || node->subType() == Node::DitaMap)
+ if (node->subType() == Node::DitaMap)
return false;
QString nodeName;
@@ -642,6 +646,10 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
if ((node->type() != Node::Document) && (!node->isQmlNode()))
writer.writeAttribute("location", node->location().fileName());
+ if (!node->since().isEmpty()) {
+ writer.writeAttribute("since", node->since());
+ }
+
switch (node->type()) {
case Node::Class:
{
@@ -654,11 +662,13 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
baseStrings.insert(baseClassNode->name());
}
writer.writeAttribute("bases", QStringList(baseStrings.toList()).join(","));
- writer.writeAttribute("module", node->moduleName());
+ if (!node->moduleName().isEmpty())
+ writer.writeAttribute("module", node->moduleName());
}
break;
case Node::Namespace:
- writer.writeAttribute("module", node->moduleName());
+ if (!node->moduleName().isEmpty())
+ writer.writeAttribute("module", node->moduleName());
break;
case Node::Document:
{
@@ -666,25 +676,30 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
Document nodes (such as manual pages) contain subtypes,
titles and other attributes.
*/
+ bool writeModuleName = false;
const DocNode* docNode = static_cast<const DocNode*>(node);
switch (docNode->subType()) {
case Node::Example:
writer.writeAttribute("subtype", "example");
+ writeModuleName = true;
break;
case Node::HeaderFile:
writer.writeAttribute("subtype", "header");
+ writeModuleName = true;
break;
case Node::File:
writer.writeAttribute("subtype", "file");
break;
case Node::Group:
writer.writeAttribute("subtype", "group");
+ writeModuleName = true;
break;
case Node::Module:
writer.writeAttribute("subtype", "module");
break;
case Node::Page:
writer.writeAttribute("subtype", "page");
+ writeModuleName = true;
break;
case Node::ExternalPage:
writer.writeAttribute("subtype", "externalpage");
@@ -702,6 +717,9 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
writer.writeAttribute("fulltitle", docNode->fullTitle());
writer.writeAttribute("subtitle", docNode->subTitle());
writer.writeAttribute("location", docNode->doc().location().fileName());
+ if (!node->moduleName().isEmpty() && writeModuleName) {
+ writer.writeAttribute("module", node->moduleName());
+ }
}
break;
case Node::Function:
@@ -1048,6 +1066,9 @@ void QDocIndexFiles::generateIndex(const QString& fileName,
if (!file.open(QFile::WriteOnly | QFile::Text))
return;
+ QString msg = "Writing index file: " + fileName;
+ Location::logToStdErr(msg);
+
gen_ = g;
QXmlStreamWriter writer(&file);
writer.setAutoFormatting(true);
diff --git a/src/tools/tools.pro b/src/tools/tools.pro
index c67d6bfd76..f7d1e651ff 100644
--- a/src/tools/tools.pro
+++ b/src/tools/tools.pro
@@ -38,6 +38,6 @@ SUBDIRS = $$TOOLS_SUBDIRS
# Ensure qdoc is built before making any docs. We rely on the existing dependency
# on bootstrap for each of the other tools to ensure they also build qdoc first,
# and likewise, the dependency of the rest of the build on tools, src, etc.
-bootstrap_docs.depends += $${src_tools_qdoc.target}-make_first
-bootstrap_docs.target = $${src_tools_bootstrap.target}-docs
-QMAKE_EXTRA_TARGETS += bootstrap_docs
+bootstrap_prepare_docs.depends += $${src_tools_qdoc.target}-make_first
+bootstrap_prepare_docs.target = $${src_tools_bootstrap.target}-prepare_docs
+QMAKE_EXTRA_TARGETS += bootstrap_prepare_docs
diff --git a/src/widgets/doc/images/widget-examples.png b/src/widgets/doc/images/widget-examples.png
new file mode 100644
index 0000000000..1e4e97c34f
--- /dev/null
+++ b/src/widgets/doc/images/widget-examples.png
Binary files differ
diff --git a/src/widgets/doc/qtwidgets.qdocconf b/src/widgets/doc/qtwidgets.qdocconf
index 5487d1ed08..1bdc96a7fc 100644
--- a/src/widgets/doc/qtwidgets.qdocconf
+++ b/src/widgets/doc/qtwidgets.qdocconf
@@ -1,37 +1,31 @@
-include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtWidgets
description = Qt Widgets Reference Documentation
-url = http://qt-project.org/doc/qt-5.0/qtwidgets
+url = http://qt-project.org/doc/qtwidgets
version = 5.0.0
qhp.projects = QtWidgets
qhp.QtWidgets.file = qtwidgets.qhp
qhp.QtWidgets.namespace = org.qt-project.qtwidgets.500
-qhp.QtWidgets.virtualFolder = qdoc
-qhp.QtWidgets.indexTitle = Qt Widgets Reference Documentation
+qhp.QtWidgets.virtualFolder = qtwidgets
+qhp.QtWidgets.indexTitle = Qt Widgets
qhp.QtWidgets.indexRoot =
qhp.QtWidgets.filterAttributes = qtwidgets 5.0.0 qtrefdoc
qhp.QtWidgets.customFilters.Qt.name = QtWidgets 5.0.0
qhp.QtWidgets.customFilters.Qt.filterAttributes = qtwidgets 5.0.0
-qhp.QtWidgets.subprojects = classes overviews examples
-qhp.QtWidgets.subprojects.classes.title = Classes
-qhp.QtWidgets.subprojects.classes.indexTitle = Qt Widgets' Classes
+
+qhp.QtWidgets.subprojects = classes
+qhp.QtWidgets.subprojects.classes.title = C++ Classes
+qhp.QtWidgets.subprojects.classes.indexTitle = Qt Widgets C++ Classes
qhp.QtWidgets.subprojects.classes.selectors = class fake:headerfile
qhp.QtWidgets.subprojects.classes.sortPages = true
-qhp.QtWidgets.subprojects.overviews.title = Overviews
-qhp.QtWidgets.subprojects.overviews.indexTitle = All Overviews and HOWTOs
-qhp.QtWidgets.subprojects.overviews.selectors = fake:page,group,module
-qhp.QtWidgets.subprojects.examples.title = Qt Widgets Examples
-qhp.QtWidgets.subprojects.examples.indexTitle = Qt Widgets Examples
-qhp.QtWidgets.subprojects.examples.selectors = fake:example
tagfile = ../../../doc/qtwidgets/qtwidgets.tags
-depends += qtcore qtgui
+depends += qtcore qtgui qtdoc qtsql
headerdirs += ..
diff --git a/src/widgets/doc/snippets/widgets-tutorial/template.cpp b/src/widgets/doc/snippets/widgets-tutorial/template.cpp
index 189578ef1b..c67ce374c0 100644
--- a/src/widgets/doc/snippets/widgets-tutorial/template.cpp
+++ b/src/widgets/doc/snippets/widgets-tutorial/template.cpp
@@ -39,7 +39,7 @@
****************************************************************************/
//! [main.cpp body]
-#include <QtGui>
+#include <QtWidgets>
// Include header files for application components.
// ...
diff --git a/src/widgets/doc/src/qtwidgets-examples.qdoc b/src/widgets/doc/src/qtwidgets-examples.qdoc
new file mode 100644
index 0000000000..b199c97823
--- /dev/null
+++ b/src/widgets/doc/src/qtwidgets-examples.qdoc
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** 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. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtwidgets-examples.html
+ \title Qt Widgets Examples
+ \brief Lots of examples of how to use different kinds of widgets.
+ \ingroup all-examples
+
+ \image widget-examples.png
+
+ Qt comes with a large range of standard widgets that users of modern
+ applications have come to expect.
+
+ You can also develop your own custom widgets and controls, and use them
+ alongside standard widgets.
+
+ It is even possible to provide custom styles and themes for widgets that can
+ be used to change the appearance of standard widgets and appropriately
+ written custom widgets.
+
+ \annotatedlist examples-widgets
+
+*/ \ No newline at end of file
diff --git a/src/widgets/doc/src/qtwidgets-index.qdoc b/src/widgets/doc/src/qtwidgets-index.qdoc
index 61f723ae7c..82e6a0109f 100644
--- a/src/widgets/doc/src/qtwidgets-index.qdoc
+++ b/src/widgets/doc/src/qtwidgets-index.qdoc
@@ -31,9 +31,6 @@
\brief A module which provides a set of C++ technologies for building user
interfaces
-Qt Widgets is a module which provides primary elements for building user
-interfaces in C++.
-
\section1 Getting Started
To include the definitions of the module's classes, use the
@@ -46,93 +43,133 @@ interfaces in C++.
\snippet code/doc_src_qtwidgets.pro 0
-\section1 Widgets
- Widgets are for building C++ user interfaces. They are customizable with
- layouts and stylesheets.
+
+
+ \section1 Widgets
+
+ Widgets are the primary elements for creating user interfaces in Qt.
+ \l{The Widget Classes}{Widgets} can display data and status information,
+ receive user input, and provide a container for other widgets that
+ should be grouped together. A widget that is not embedded in a
+ parent widget is called a \l{Window and Dialog Widgets} {window}.
+
+ \image parent-child-widgets.png A parent widget containing various child widgets.
+
+ The QWidget class provides the basic capability to render to the
+ screen, and to handle user input events. All UI elements that Qt
+ provides are either subclasses of QWidget, or are used in connection
+ with a QWidget subclass. Creating custom widgets is done by
+ subclassing QWidget or a suitable subclass and reimplementing the
+ virtual event handlers.
\list
- \li \l{Basic Widgets}
- \li \l{Advanced Widgets}
- \li \l{Organizers}
- \li \l{Widgets Tutorial}
\li \l{Window and Dialog Widgets}
\li \l{Application Main Window}
- \li \l{Standard Dialogs}
\li \l{Dialog Windows}
\endlist
- Qt's support for widget styles and themes enables your application to fit in
- with the native desktop environment. Below, you can find links to the
- various widget styles that are supplied with Qt Widgets.
- \list
- \li \l{Qt Widget Gallery}
- \li \l{Plastique Style Widget Gallery}
- \li \l{Cleanlooks Style Widget Gallery}
- \li \l{Windows XP Style Widget Gallery}
- \li \l{Windows Vista Style Widget Gallery}
- \li \l{GTK Style Widget Gallery}
- \li \l{Macintosh Style Widget Gallery}
- \endlist
+ \section1 Styles
- \section2 Layouts
+ \l{Styles and Style Aware Widgets}{Styles} draw on behalf of
+ widgets and encapsulate the look and feel of a GUI. Qt's built-in
+ widgets use the QStyle class to perform nearly all of their drawing,
+ ensuring that they look exactly like the equivalent native widgets.
- Widgets may use to automatically arrange child widgets within their
- container. Each widget reports its size requirements to the layout and the
- layout distributes the available space accordingly.
+ \table
+ \row
+ \li \image windowsxp-tabwidget.png
+ \li \image plastique-tabwidget.png
+ \li \image macintosh-tabwidget.png
+ \endtable
- \list
- \liĀ \l{Widgets and Layouts}
- \li \l{Qt Designer Integration}
- \li \l{Layout Management}
- \endlist
+ \l{Qt Style Sheets} are a powerful mechanism that allows you to customize the
+ appearance of widgets, in addition to what is already possible by subclassing QStyle.
- \section2 Style Sheets
- \l{Qt Style Sheets} are a powerful mechanism that allows for customization
- of the appearance of widgets. The concepts, terminology, and syntax of Qt
- Style Sheets are heavily inspired by HTML Cascading Style Sheets (CSS) but
- adapted to the world of widgets.
+ \section1 Layouts
- \list
- \li \l{Customizing Qt Widgets Using Style Sheets}
- \li \l{Qt Style Sheets}
- \li \l{The Style Sheet Syntax}
- \li \l{Styles and Style Aware Widgets}
- \li \l{Qt Style Sheets Examples}
- \endlist
+ \l{Layout Management}{Layouts} are an elegant and flexible way to
+ automatically arrange child widgets within their container. Each
+ widget reports its size requirements to the layout through the
+ \l{QWidget::}{sizeHint} and \l{QWidget::}{sizePolicy} properties,
+ and the layout distributes the available space accordingly.
-\section1 Graphics View
+ \table
+ \row
+ \li \image qgridlayout-with-5-children.png
+ \li \image qformlayout-with-6-children.png
+ \endtable
- The \l{Graphics View Framework} is for managing and interacting with a large
- number of custom-made 2D graphical items, and a view widget for visualizing
- the items, with support for zooming and rotation.
+ \l {Qt Designer} is a powerful tool for interactively creating and
+ arranging widgets in layouts.
-\section1 Model/View
+
+
+ \section1 Model/View Classes
The \l{Model/View Programming}{model/view} architecture provides classes
that manage the way data is presented to the user. Data-driven applications
which use lists and tables are structured to separate the data and view
using models, views, and delegates.
+ \image windowsxp-treeview.png
+
+ \section1 Graphics View
+
+ The \l{Graphics View Framework} is for managing and interacting with a large
+ number of custom-made 2D graphical items, and a view widget for visualizing
+ the items, with support for zooming and rotation.
+
+ \image graphicsview-items.png
+
+ \section1 Related Information
+
+ \section2 Tutorials
\list
- \li \l{Model/View Programming}
- \li \l{Model/View Tutorial}
+ \li \l{Widgets Tutorial}
+ \li \l{Model/View Tutorial}
\endlist
-\section1 Reference
+ \section2 Examples
+ \list
+ \li \l{Qt Widgets Examples}
+ \endlist
+ \section2 API Reference
+ These are links to the API reference materials.
-\list
-\li \l{Qt Widgets C++ API}
\list
- \li \l{Abstract Widget Classes}
- \li \l{Graphics View Classes}
- \li \l{Model/View Classes}
- \li \l{Main Window and Related Classes}
- \li \l{Widget Appearance and Style Related Classes}
- \li \l{Layout Classes}
+ \li \l{Qt Widgets C++ Classes}
+ \list
+ \li \l{Abstract Widget Classes}
+ \li \l{Graphics View Classes}
+ \li \l{Model/View Classes}
+ \li \l{Main Window and Related Classes}
+ \li \l{Widget Appearance and Style Related Classes}
+ \li \l{Layout Classes}
+ \endlist
+ \li \l{Qt Style Sheets Reference}
\endlist
-\li \l{Qt Style Sheets Reference}
-\endlist
+
*/
+
+ /*!
+ \group advanced
+ \title Advanced Widgets
+ */
+
+ /*!
+ \group abstractwidgets
+ \title Abstract Widget Classes
+ */
+
+ /*!
+ \group basicwidgets
+ \title Basic Widgets
+ */
+
+ /*!
+ \group organizers
+ \title Organizers
+ */
diff --git a/src/widgets/doc/src/qtwidgets.qdoc b/src/widgets/doc/src/qtwidgets.qdoc
index f192c5114e..5638e7b4d4 100644
--- a/src/widgets/doc/src/qtwidgets.qdoc
+++ b/src/widgets/doc/src/qtwidgets.qdoc
@@ -27,7 +27,7 @@
/*!
\module QtWidgets
- \title Qt Widgets C++ API
+ \title Qt Widgets C++ Classes
\ingroup modules
\brief The QtWidgets module extends Qt Gui with C++ widget functionality.
diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery.qdoc
index 64bdd3ab9a..9acacc24e7 100644
--- a/src/widgets/doc/src/widgets-and-layouts/gallery.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/gallery.qdoc
@@ -32,7 +32,7 @@
Qt's support for widget styles and themes enables your application to fit in
with the native desktop environment. Below, you can find links to the various
- widget styles that are supplied with Qt 4.
+ widget styles that are supplied with Qt.
\table
\row
diff --git a/src/xml/doc/qtxml.qdocconf b/src/xml/doc/qtxml.qdocconf
index 1759112950..038993a558 100644
--- a/src/xml/doc/qtxml.qdocconf
+++ b/src/xml/doc/qtxml.qdocconf
@@ -1,37 +1,31 @@
-include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtXml
description = Qt XML Reference Documentation
-url = http://qt-project.org/doc/qt-5.0/qtxml
+url = http://qt-project.org/doc/qtxml
version = 5.0.0
qhp.projects = QtXml
qhp.QtXml.file = qtxml.qhp
qhp.QtXml.namespace = org.qt-project.qtxml.500
-qhp.QtXml.virtualFolder = qdoc
-qhp.QtXml.indexTitle = Qt XML Reference Documentation
+qhp.QtXml.virtualFolder = qtxml
+qhp.QtXml.indexTitle = Qt XML
qhp.QtXml.indexRoot =
qhp.QtXml.filterAttributes = qtxml 5.0.0 qtrefdoc
qhp.QtXml.customFilters.Qt.name = QtXml 5.0.0
qhp.QtXml.customFilters.Qt.filterAttributes = qtxml 5.0.0
-qhp.QtXml.subprojects = classes overviews examples
-qhp.QtXml.subprojects.classes.title = Classes
-qhp.QtXml.subprojects.classes.indexTitle = Qt XML's Classes
+
+qhp.QtXml.subprojects = classes
+qhp.QtXml.subprojects.classes.title = C++ Classes
+qhp.QtXml.subprojects.classes.indexTitle = Qt XML C++ Classes
qhp.QtXml.subprojects.classes.selectors = class fake:headerfile
qhp.QtXml.subprojects.classes.sortPages = true
-qhp.QtXml.subprojects.overviews.title = Overviews
-qhp.QtXml.subprojects.overviews.indexTitle = All Overviews and HOWTOs
-qhp.QtXml.subprojects.overviews.selectors = fake:page,group,module
-qhp.QtXml.subprojects.examples.title = Qt XML Examples
-qhp.QtXml.subprojects.examples.indexTitle = Qt XML Examples
-qhp.QtXml.subprojects.examples.selectors = fake:example
tagfile = ../../../doc/qtxml/qtxml.tags
-depends += qtcore
+depends += qtcore qtnetwork qtdoc
headerdirs += ..