summaryrefslogtreecommitdiffstats
path: root/examples/widgets/doc
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/doc')
-rw-r--r--examples/widgets/doc/images/addressbook-editdialog.pngbin8669 -> 11374 bytes
-rw-r--r--examples/widgets/doc/images/addressbook-example.pngbin12388 -> 20047 bytes
-rw-r--r--examples/widgets/doc/images/addressbook-newaddresstab.pngbin12556 -> 17413 bytes
-rw-r--r--examples/widgets/doc/images/graphicssimpleanchorlayout-example.pngbin16743 -> 11301 bytes
-rw-r--r--examples/widgets/doc/images/itemviews-editabletreemodel.pngbin32534 -> 30556 bytes
-rw-r--r--examples/widgets/doc/images/notepad.pngbin0 -> 12418 bytes
-rw-r--r--examples/widgets/doc/images/notepad1.pngbin0 -> 12418 bytes
-rw-r--r--examples/widgets/doc/images/notepad2.pngbin0 -> 22700 bytes
-rw-r--r--examples/widgets/doc/images/notepad3.pngbin0 -> 40584 bytes
-rw-r--r--examples/widgets/doc/images/notepad4.pngbin0 -> 9494 bytes
-rw-r--r--examples/widgets/doc/images/notepad_menu.pngbin0 -> 8657 bytes
-rw-r--r--examples/widgets/doc/images/stylesheet-pagefold.pngbin15989 -> 29118 bytes
-rw-r--r--examples/widgets/doc/src/addressbook.qdoc43
-rw-r--r--examples/widgets/doc/src/appchooser.qdoc38
-rw-r--r--examples/widgets/doc/src/basiclayouts.qdoc6
-rw-r--r--examples/widgets/doc/src/blurpicker.qdoc9
-rw-r--r--examples/widgets/doc/src/calendarwidget.qdoc10
-rw-r--r--examples/widgets/doc/src/collidingmice-example.qdoc10
-rw-r--r--examples/widgets/doc/src/configdialog.qdoc37
-rw-r--r--examples/widgets/doc/src/customsortfiltermodel.qdoc6
-rw-r--r--examples/widgets/doc/src/dragdroprobot.qdoc2
-rw-r--r--examples/widgets/doc/src/draggabletext.qdoc1
-rw-r--r--examples/widgets/doc/src/easing.qdoc3
-rw-r--r--examples/widgets/doc/src/elasticnodes.qdoc9
-rw-r--r--examples/widgets/doc/src/findfiles.qdoc41
-rw-r--r--examples/widgets/doc/src/graphicsview-anchorlayout.qdoc43
-rw-r--r--examples/widgets/doc/src/graphicsview-simpleanchorlayout.qdoc46
-rw-r--r--examples/widgets/doc/src/lighting.qdoc35
-rw-r--r--examples/widgets/doc/src/painterpaths.qdoc11
-rw-r--r--examples/widgets/doc/src/stardelegate.qdoc16
-rw-r--r--examples/widgets/doc/src/stylesheet.qdoc51
-rw-r--r--examples/widgets/doc/src/tablet.qdoc13
-rw-r--r--examples/widgets/doc/src/validators.qdoc2
33 files changed, 237 insertions, 195 deletions
diff --git a/examples/widgets/doc/images/addressbook-editdialog.png b/examples/widgets/doc/images/addressbook-editdialog.png
index fd41ee63f7..7434aa44ef 100644
--- a/examples/widgets/doc/images/addressbook-editdialog.png
+++ b/examples/widgets/doc/images/addressbook-editdialog.png
Binary files differ
diff --git a/examples/widgets/doc/images/addressbook-example.png b/examples/widgets/doc/images/addressbook-example.png
index b743c166da..eebe97a718 100644
--- a/examples/widgets/doc/images/addressbook-example.png
+++ b/examples/widgets/doc/images/addressbook-example.png
Binary files differ
diff --git a/examples/widgets/doc/images/addressbook-newaddresstab.png b/examples/widgets/doc/images/addressbook-newaddresstab.png
index ff215a4b20..6b60ee08e9 100644
--- a/examples/widgets/doc/images/addressbook-newaddresstab.png
+++ b/examples/widgets/doc/images/addressbook-newaddresstab.png
Binary files differ
diff --git a/examples/widgets/doc/images/graphicssimpleanchorlayout-example.png b/examples/widgets/doc/images/graphicssimpleanchorlayout-example.png
index 543670e05c..e4bed44edf 100644
--- a/examples/widgets/doc/images/graphicssimpleanchorlayout-example.png
+++ b/examples/widgets/doc/images/graphicssimpleanchorlayout-example.png
Binary files differ
diff --git a/examples/widgets/doc/images/itemviews-editabletreemodel.png b/examples/widgets/doc/images/itemviews-editabletreemodel.png
index a151ea857f..ff6cf637a1 100644
--- a/examples/widgets/doc/images/itemviews-editabletreemodel.png
+++ b/examples/widgets/doc/images/itemviews-editabletreemodel.png
Binary files differ
diff --git a/examples/widgets/doc/images/notepad.png b/examples/widgets/doc/images/notepad.png
new file mode 100644
index 0000000000..40d13269b9
--- /dev/null
+++ b/examples/widgets/doc/images/notepad.png
Binary files differ
diff --git a/examples/widgets/doc/images/notepad1.png b/examples/widgets/doc/images/notepad1.png
new file mode 100644
index 0000000000..40d13269b9
--- /dev/null
+++ b/examples/widgets/doc/images/notepad1.png
Binary files differ
diff --git a/examples/widgets/doc/images/notepad2.png b/examples/widgets/doc/images/notepad2.png
new file mode 100644
index 0000000000..9cec1f9a58
--- /dev/null
+++ b/examples/widgets/doc/images/notepad2.png
Binary files differ
diff --git a/examples/widgets/doc/images/notepad3.png b/examples/widgets/doc/images/notepad3.png
new file mode 100644
index 0000000000..426861ab06
--- /dev/null
+++ b/examples/widgets/doc/images/notepad3.png
Binary files differ
diff --git a/examples/widgets/doc/images/notepad4.png b/examples/widgets/doc/images/notepad4.png
new file mode 100644
index 0000000000..fc08eab204
--- /dev/null
+++ b/examples/widgets/doc/images/notepad4.png
Binary files differ
diff --git a/examples/widgets/doc/images/notepad_menu.png b/examples/widgets/doc/images/notepad_menu.png
new file mode 100644
index 0000000000..2dd771111a
--- /dev/null
+++ b/examples/widgets/doc/images/notepad_menu.png
Binary files differ
diff --git a/examples/widgets/doc/images/stylesheet-pagefold.png b/examples/widgets/doc/images/stylesheet-pagefold.png
index 5ccb4edbc9..d1358f326b 100644
--- a/examples/widgets/doc/images/stylesheet-pagefold.png
+++ b/examples/widgets/doc/images/stylesheet-pagefold.png
Binary files differ
diff --git a/examples/widgets/doc/src/addressbook.qdoc b/examples/widgets/doc/src/addressbook.qdoc
index b9bcae21aa..1fa0bfa9d4 100644
--- a/examples/widgets/doc/src/addressbook.qdoc
+++ b/examples/widgets/doc/src/addressbook.qdoc
@@ -60,8 +60,8 @@
the address book.
\c TableModel is a subclass of QAbstractTableModel that provides
- the standard model/view API to access data. It also holds a
- QList of \l{QPair}s corresponding to the contacts added.
+ the standard model/view API to access data. It holds a list of
+ added contacts.
However, this data is not all visible in a single tab. Instead,
QTableView is used to provide 9 different views of the same
data, according to the alphabet groups.
@@ -80,7 +80,7 @@
\section1 TableModel Class Definition
The \c TableModel class provides standard API to access data in
- its QList of \l{QPair}s by subclassing QAbstractTableModel. The
+ its list of contacts by subclassing QAbstractTableModel. The
basic functions that must be implemented in order to do so are:
\c rowCount(), \c columnCount(), \c data(), \c headerData().
For TableModel to be editable, it has to provide implementations
@@ -90,15 +90,14 @@
\snippet itemviews/addressbook/tablemodel.h 0
Two constructors are used, a default constructor which uses
- \c TableModel's own \c {QList<QPair<QString, QString>>} and one
- that takes \c {QList<QPair<QString, QString>} as an argument,
- for convenience.
+ \c TableModel's own \c {QList<Contact>} and one that takes
+ \c {QList<Contact>} as an argument, for convenience.
\section1 TableModel Class Implementation
We implement the two constructors as defined in the header file.
- The second constructor initializes the list of pairs in the
+ The second constructor initializes the list of contacts in the
model, with the parameter value.
\snippet itemviews/addressbook/tablemodel.cpp 0
@@ -117,7 +116,7 @@
The \c data() function returns either a \b Name or
\b {Address}, based on the contents of the model index
supplied. The row number stored in the model index is used to
- reference an item in the list of pairs. Selection is handled
+ reference an item in the list of contacts. Selection is handled
by the QItemSelectionModel, which will be explained with
\c AddressWidget.
@@ -164,12 +163,11 @@
use the editing features of the QTableView object, we enable
them here so that we can reuse the model in other programs.
- The last function in \c {TableModel}, \c getList() returns the
- QList<QPair<QString, QString>> object that holds all the
- contacts in the address book. We use this function later to
- obtain the list of contacts to check for existing entries, write
- the contacts to a file and read them back. Further explanation is
- given with \c AddressWidget.
+ The last function in \c {TableModel}, \c getContacts() returns the
+ QList<Contact> object that holds all the contacts in the address
+ book. We use this function later to obtain the list of contacts to
+ check for existing entries, write the contacts to a file and read
+ them back. Further explanation is given with \c AddressWidget.
\snippet itemviews/addressbook/tablemodel.cpp 8
@@ -222,11 +220,12 @@
The QItemSelectionModel class provides a
\l{QItemSelectionModel::selectionChanged()}{selectionChanged}
signal that is connected to \c{AddressWidget}'s
- \c selectionChanged() signal. This signal to signal connection
- is necessary to enable the \uicontrol{Edit Entry...} and
- \uicontrol{Remove Entry} actions in \c MainWindow's Tools menu. This
- connection is further explained in \c MainWindow's
- implementation.
+ \c selectionChanged() signal. We also connect
+ QTabWidget::currentChanged() signal to the lambda expression which
+ emits \c{AddressWidget}'s \c selectionChanged() as well. These
+ connections are necessary to enable the \uicontrol{Edit Entry...} and
+ \uicontrol{Remove Entry} actions in \c MainWindow's Tools menu.
+ It is further explained in \c MainWindow's implementation.
Each table view in the address book is added as a tab to the
QTabWidget with the relevant label, obtained from the QStringList
@@ -250,7 +249,7 @@
Basic validation is done in the second \c addEntry() function to
prevent duplicate entries in the address book. As mentioned with
\c TableModel, this is part of the reason why we require the
- getter method \c getList().
+ getter method \c getContacts().
\snippet itemviews/addressbook/addresswidget.cpp 3
@@ -292,7 +291,7 @@
The \c writeToFile() function is used to save a file containing
all the contacts in the address book. The file is saved in a
- custom \c{.dat} format. The contents of the QList of \l{QPair}s
+ custom \c{.dat} format. The contents of the list of contacts
are written to \c file using QDataStream. If the file cannot be
opened, a QMessageBox is displayed with the related error message.
@@ -301,7 +300,7 @@
The \c readFromFile() function loads a file containing all the
contacts in the address book, previously saved using
\c writeToFile(). QDataStream is used to read the contents of a
- \c{.dat} file into a list of pairs and each of these is added
+ \c{.dat} file into a list of contacts and each of these is added
using \c addEntry().
\snippet itemviews/addressbook/addresswidget.cpp 7
diff --git a/examples/widgets/doc/src/appchooser.qdoc b/examples/widgets/doc/src/appchooser.qdoc
deleted file mode 100644
index e74860214a..0000000000
--- a/examples/widgets/doc/src/appchooser.qdoc
+++ /dev/null
@@ -1,38 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/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: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example animation/appchooser
- \title Application Chooser Example
-
- \brief The Application Chooser example shows how to use the Qt state
- machine and the animation framework to select between
- applications.
-
- \image appchooser-example.png
-
-*/
diff --git a/examples/widgets/doc/src/basiclayouts.qdoc b/examples/widgets/doc/src/basiclayouts.qdoc
index 01bcaa8c1a..e9d7cea21b 100644
--- a/examples/widgets/doc/src/basiclayouts.qdoc
+++ b/examples/widgets/doc/src/basiclayouts.qdoc
@@ -67,11 +67,11 @@
In the constructor, we first use the \c createMenu() function to
create and populate a menu bar and the \c createHorizontalGroupBox()
function to create a group box containing four buttons with a
- horizontal layout. Next we use the \c createGridGroupBox() function
+ horizontal layout. Next, we use the \c createGridGroupBox() function
to create a group box containing several line edits and a small text
editor which are displayed in a grid layout. Finally, we use the
\c createFormGroupBox() function to create a group box with
- three labels and three input fields: a line edit, a combo box and
+ three labels and three input fields: a line edit, a combo box, and
a spin box.
\snippet layouts/basiclayouts/dialog.cpp 1
@@ -111,7 +111,7 @@
\snippet layouts/basiclayouts/dialog.cpp 4
We use the QBoxLayout::addWidget() function to add the widgets to
- the end of layout. Each widget will get at least its minimum size
+ the end of the layout. Each widget will get at least its minimum size
and at most its maximum size. It is possible to specify a stretch
factor in the \l {QBoxLayout::addWidget()}{addWidget()} function,
and any excess space is shared according to these stretch
diff --git a/examples/widgets/doc/src/blurpicker.qdoc b/examples/widgets/doc/src/blurpicker.qdoc
index f12184e4c9..87f36389e7 100644
--- a/examples/widgets/doc/src/blurpicker.qdoc
+++ b/examples/widgets/doc/src/blurpicker.qdoc
@@ -32,4 +32,13 @@
\brief Demonstrates how to apply graphical effects on items in the view
\image blurpickereffect-example.png
+
+ The Blur Picker example displays a circle of application icons.
+ All icons are blurred, except the one on the bottom left side of
+ the screen, which is the one in focus.
+ Clicking anywhere on the left side of the screen moves the icon
+ circle clockwise to the next icon
+ Clicking on the right side advances the circle counterclockwise.
+
+ \sa QGraphicsBlurEffect
*/
diff --git a/examples/widgets/doc/src/calendarwidget.qdoc b/examples/widgets/doc/src/calendarwidget.qdoc
index eaf8f547da..c04fab1fc7 100644
--- a/examples/widgets/doc/src/calendarwidget.qdoc
+++ b/examples/widgets/doc/src/calendarwidget.qdoc
@@ -110,8 +110,8 @@
size hints of its contents widgets.
To ensure that the window isn't automatically resized every time
- we change a property of the QCalendarWidget (e.g., hiding the
- navigation bar, trhe vertical header, or the grid), we set the
+ we change a property of the QCalendarWidget (for example, hiding the
+ navigation bar, the vertical header, or the grid), we set the
minimum height of row 0 and the minimum width of column 0 to the
initial size of the QCalendarWidget.
@@ -126,8 +126,8 @@
the formatting specified by the user.
The \c createGeneralOptionsGroupBox() function is somewhat large
- and several widgets are set up the same way; we look at parts of
- its implementation here and skip the rest:
+ and several widgets are set up in the same way. We will look at
+ parts of its implementation here and skip the rest:
\snippet widgets/calendarwidget/window.cpp 10
\dots
@@ -146,7 +146,7 @@
\snippet widgets/calendarwidget/window.cpp 11
\dots
- After creating the widgets, we connect the signals and slots. We
+ After having created the widgets, we connect the signals and slots. We
connect the comboboxes to private slots of \c Window or to
public slots provided by QComboBox.
diff --git a/examples/widgets/doc/src/collidingmice-example.qdoc b/examples/widgets/doc/src/collidingmice-example.qdoc
index 02417ba521..535057bb6a 100644
--- a/examples/widgets/doc/src/collidingmice-example.qdoc
+++ b/examples/widgets/doc/src/collidingmice-example.qdoc
@@ -80,8 +80,7 @@
\snippet graphicsview/collidingmice/mouse.cpp 0
To calculate the various components of the mouse's color, we use
- the global qrand() function which is a thread-safe version of the
- standard C++ rand() function.
+ \l QRandomGenerator.
Then we call the \l {QGraphicsItem::setRotation()}{setRotation()} function
inherited from QGraphicsItem. Items live in their own local
@@ -178,12 +177,7 @@
\snippet graphicsview/collidingmice/main.cpp 0
- First, we create an application object and call the global
- qsrand() function to specify the seed used to generate a new
- random number sequence of pseudo random integers with the
- previously mentioned qrand() function.
-
- Then it is time to create the scene:
+ First, we create an application object and create the scene:
\snippet graphicsview/collidingmice/main.cpp 1
diff --git a/examples/widgets/doc/src/configdialog.qdoc b/examples/widgets/doc/src/configdialog.qdoc
deleted file mode 100644
index 9f2cc21adb..0000000000
--- a/examples/widgets/doc/src/configdialog.qdoc
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/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: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example dialogs/configdialog
- \title Config Dialog Example
- \ingroup examples-dialogs
-
- \brief The Config Dialog examples shows how a configuration dialog can be created by
- using an icon view with a stacked widget.
-
- \image configdialog-example.png
-*/
diff --git a/examples/widgets/doc/src/customsortfiltermodel.qdoc b/examples/widgets/doc/src/customsortfiltermodel.qdoc
index 0eb6560e10..6eab846e89 100644
--- a/examples/widgets/doc/src/customsortfiltermodel.qdoc
+++ b/examples/widgets/doc/src/customsortfiltermodel.qdoc
@@ -75,7 +75,7 @@
QSortFilterProxyModel's default implementations of functions are
written so that they call the equivalent functions in the relevant
source model. This simple proxying mechanism may need to be
- overridden for source models with more complex behavior; in this
+ overridden for source models with more complex behavior. In this
example we derive from the QSortFilterProxyModel class to ensure
that our filter can recognize a valid range of dates, and to
control the sorting behavior.
@@ -170,7 +170,7 @@
We implement two private slots, \c textFilterChanged() and \c
dateFilterChanged(), to respond to the user changing the filter
- pattern, case sensitivity or any of the dates. In addition, we
+ pattern, case sensitivity, or any of the dates. In addition, we
implement a public \c setSourceModel() convenience function to set
up the model/ view relation.
@@ -197,7 +197,7 @@
\snippet itemviews/customsortfiltermodel/window.cpp 1
The QTreeView class provides a default model/view implementation
- of a tree view; our view implements a tree representation of items
+ of a tree view. Our view implements a tree representation of items
in the application's source model.
\snippet itemviews/customsortfiltermodel/window.cpp 2
diff --git a/examples/widgets/doc/src/dragdroprobot.qdoc b/examples/widgets/doc/src/dragdroprobot.qdoc
index ac221ec5f9..f74b898e1b 100644
--- a/examples/widgets/doc/src/dragdroprobot.qdoc
+++ b/examples/widgets/doc/src/dragdroprobot.qdoc
@@ -257,7 +257,7 @@
\snippet graphicsview/dragdroprobot/coloritem.cpp 0
\c ColorItem's constructor assigns an opaque random color to its color
- member by making use of qrand(). For improved usability, it assigns a
+ member by making use of \l QRandomGenerator. For improved usability, it assigns a
tooltip that provides a useful hint to the user, and it also sets a
suitable cursor. This ensures that the cursor will chance to
Qt::OpenHandCursor when the mouse pointer hovers over the item.
diff --git a/examples/widgets/doc/src/draggabletext.qdoc b/examples/widgets/doc/src/draggabletext.qdoc
index c4a694028b..97b2f036bd 100644
--- a/examples/widgets/doc/src/draggabletext.qdoc
+++ b/examples/widgets/doc/src/draggabletext.qdoc
@@ -28,6 +28,7 @@
/*!
\example draganddrop/draggabletext
\title Draggable Text Example
+ \brief Illustrates how to drag and drop text between widgets
\brief The Draggable Text example shows how to drag and drop textual data between widgets
in the same application, and between different applications.
diff --git a/examples/widgets/doc/src/easing.qdoc b/examples/widgets/doc/src/easing.qdoc
index 3a9727d393..807dd72e93 100644
--- a/examples/widgets/doc/src/easing.qdoc
+++ b/examples/widgets/doc/src/easing.qdoc
@@ -34,4 +34,7 @@
\image easing-example.png
+ See \l QEasingCurve for a detailed description on how to use the class's
+ functionalities.
+
*/
diff --git a/examples/widgets/doc/src/elasticnodes.qdoc b/examples/widgets/doc/src/elasticnodes.qdoc
index 09ac891b24..65e1195121 100644
--- a/examples/widgets/doc/src/elasticnodes.qdoc
+++ b/examples/widgets/doc/src/elasticnodes.qdoc
@@ -424,9 +424,8 @@
\section1 The main() Function
In contrast to the complexity of the rest of this example, the \c main()
- function is very simple: We create a QApplication instance, seed the
- randomizer using qsrand(), and then create and show an instance of \c
- GraphWidget. Because all nodes in the grid are moved initially, the \c
- GraphWidget timer will start immediately after control has returned to the
- event loop.
+ function is very simple: We create a QApplication instance, then create and
+ show an instance of \c GraphWidget. Because all nodes in the grid are moved
+ initially, the \c GraphWidget timer will start immediately after control
+ has returned to the event loop.
*/
diff --git a/examples/widgets/doc/src/findfiles.qdoc b/examples/widgets/doc/src/findfiles.qdoc
index b8363dc698..a2eb326519 100644
--- a/examples/widgets/doc/src/findfiles.qdoc
+++ b/examples/widgets/doc/src/findfiles.qdoc
@@ -74,19 +74,23 @@
\snippet dialogs/findfiles/window.cpp 0
- We create the application's buttons using the private \c
- createButton() function. Then we create the comboboxes associated
- with the search specifications, using the private \c
- createComboBox() function. We also create the application's labels
- before we use the private \c createFilesTable() function to create
- the table displaying the search results.
+ We create the widgets to build up the UI, and we add them to a main layout
+ using QGridLayout. We have, however, put the \c Find and \c Quit buttons
+ and a stretchable space in a separate \l QHBoxLayout first, to make the
+ buttons appear in the \c Window widget's bottom right corner.
+
+ Alternatively, we could have used Qt Designer to construct a UI file,
+ and \l {uic} to generate this code.
\snippet dialogs/findfiles/window.cpp 1
- Then we add all the widgets to a main layout using QGridLayout. We
- have, however, put the \c Find and \c Quit buttons and a
- stretchable space in a separate QHBoxLayout first, to make the
- buttons appear in the \c Window widget's bottom right corner.
+ We did not create a \l QMenuBar with a \uicontrol Quit menu item; but we
+ would still like to have a keyboard shortcut for quitting. Since we
+ construct a \l QShortcut with \l QKeySequence::Quit, and connect it to
+ \l QApplication::quit(), on most platforms it will be possible to press
+ Control-Q to quit (or whichever standard Quit key is configured on that platform).
+ (On \macos, this is redundant, because every application gets a
+ \uicontrol Quit menu item automatically; but it helps to make the application portable.)
\snippet dialogs/findfiles/window.cpp 2
@@ -122,18 +126,16 @@
We use the directory's path to create a QDir; the QDir class
provides access to directory structures and their contents.
- \snippet dialogs/findfiles/window.cpp 13
-
- We recursively create a list of the files (contained in the newl
- created QDir) that match the specified file name.
+ We use QDirIterator to iterate over the files that match the
+ specified file name and build a QStringList of paths.
Then we search through all the files in the list, using the private
- \c findFiles() function, eliminating the ones that don't contain
- the specified text. And finally, we display the results using the
- private \c showFiles() function.
+ \c findFiles() function, eliminating the ones that don't contain the
+ specified text. We sort them (because QDirIterator did not). And finally,
+ we display the results using the private \c showFiles() function.
If the user didn't specify any text, there is no reason to search
- through the files, and we display the results immediately.
+ through the files, so we sort and display the results immediately.
\image findfiles_progress_dialog.png Screenshot of the Progress Dialog
@@ -196,7 +198,8 @@
the \c find() slot. In the \c showFiles() function we run through
the provided list of file names, adding each relative file name to the
first column in the table widget and retrieving the file's size using
- QFileInfo for the second column. For later use, we set
+ QFileInfo for the second column. We use \l QLocale::formattedDataSize()
+ to format the file size in a human-readable form. For later use, we set
the absolute path as a data on the QTableWidget using the
the role absoluteFileNameRole defined to be Qt::UserRole + 1.
diff --git a/examples/widgets/doc/src/graphicsview-anchorlayout.qdoc b/examples/widgets/doc/src/graphicsview-anchorlayout.qdoc
index 95717340d1..bd27a0dc4f 100644
--- a/examples/widgets/doc/src/graphicsview-anchorlayout.qdoc
+++ b/examples/widgets/doc/src/graphicsview-anchorlayout.qdoc
@@ -35,4 +35,47 @@
class.
\image graphicsanchorlayout-example.png
+
+ The basic steps of this example are:
+ \list
+ \li Create a QGraphicsScene
+ \li Create widgets
+ \li Create a QGraphicsAnchorLayout
+ \li Create a QGraphicsWidget
+ \li Add vertical and horizontal anchors between the widgets
+ \li View the scene with a QGraphicsView object
+ \endlist
+
+ \section1 Creating a QGraphicsScene
+
+ \quotefromfile graphicsview/anchorlayout/main.cpp
+ \skipto QGraphicsScene
+ \printuntil setSceneRect
+
+ \section1 Creating Widgets
+
+ \skipto QGraphicsProxyWidget
+ \printuntil *g
+
+ \section1 Creating a Layout
+
+ \skipto QGraphicsAnchorLayout
+ \printuntil l->setSpacing
+
+ \section1 Creating a QGraphicsWidget
+
+ \skipto QGraphicsWidget
+ \printuntil setLayout(l)
+
+ \section1 Adding Anchors
+
+ \skipto vertical
+ \printuntil l->addAnchor(f, Qt::AnchorRight
+
+ \section1 Viewing the Scene with QGraphicsView
+
+ \skipto scene.addItem
+ \printuntil view.show
+
+ \sa {Simple Anchor Layout Example}
*/
diff --git a/examples/widgets/doc/src/graphicsview-simpleanchorlayout.qdoc b/examples/widgets/doc/src/graphicsview-simpleanchorlayout.qdoc
index 866dac442b..fd0427fdc0 100644
--- a/examples/widgets/doc/src/graphicsview-simpleanchorlayout.qdoc
+++ b/examples/widgets/doc/src/graphicsview-simpleanchorlayout.qdoc
@@ -35,4 +35,50 @@
QGraphicsAnchorLayout class.
\image graphicssimpleanchorlayout-example.png
+
+ The example starts by creating a QGraphicsScene (\c scene), 3 widgets
+ (\c a, \c b, and \c c), and a QGraphicsAnchorlayout (\c layout).
+
+ \quotefromfile graphicsview/simpleanchorlayout/main.cpp
+ \skipto QGraphicsScene
+ \printuntil QGraphicsAnchorLayout
+
+ First it anchors the top left corner of item \c a to the top left
+ corner of \c layout. This can be done in two steps:
+
+ \skipto layout->addAnchor(a
+ \printto adding
+
+ Or in one step:
+
+ \skipuntil [adding a corner anchor]
+ \printline layout->addCornerAnchors(a, Qt::T
+
+ Then the right anchor of \c a is anchored to the left anchor of
+ \c b, and the top of item \c b is anchored to the bottom of \c a.
+
+ \skipuntil [adding anchors]
+ \printto adding anchors
+
+ Place a third widget \c c under widget \c b:
+
+ \skipuntil third widget
+ \printline AnchorBottom
+
+ Items \c b and \c c are anchored to each other horizontally:
+
+ \skipto Qt::Horizontal
+ \printline Qt::Horizontal
+
+ Item c is anchored to the bottom right point of \c layout
+
+ \skipuntil corner of the layout
+ \printline Qt::BottomRightCorner
+
+ Finally, QGraphicsWidget \c w is displayed in QGraphicsView \c view.
+
+ \skipto QGraphicsWidget
+ \printuntil app.exec()
+
+ \sa {Anchor Layout Example}
*/
diff --git a/examples/widgets/doc/src/lighting.qdoc b/examples/widgets/doc/src/lighting.qdoc
deleted file mode 100644
index 994172cf5d..0000000000
--- a/examples/widgets/doc/src/lighting.qdoc
+++ /dev/null
@@ -1,35 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/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: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example effects/lighting
- \title Lighting Effect Example
- \ingroup examples-graphicsview-graphicseffects
- \brief Demonstrates how to apply effects on items in the view
-
- \image lightingeffect-example.png
-*/
diff --git a/examples/widgets/doc/src/painterpaths.qdoc b/examples/widgets/doc/src/painterpaths.qdoc
index 2cc5ff410a..bd821ac1bf 100644
--- a/examples/widgets/doc/src/painterpaths.qdoc
+++ b/examples/widgets/doc/src/painterpaths.qdoc
@@ -98,14 +98,9 @@
\section1 Window Class Implementation
- In the implementation of the \c Window class we first declare the
- constant \c Pi with six significant figures:
-
- \snippet painting/painterpaths/window.cpp 0
-
- In the constructor, we then define the various painter paths and
- create corresponding \c RenderArea widgets which will render the
- graphical shapes:
+ In the \c Window constructor, we define the various painter paths
+ and create corresponding \c RenderArea widgets which will render
+ the graphical shapes:
\snippet painting/painterpaths/window.cpp 1
diff --git a/examples/widgets/doc/src/stardelegate.qdoc b/examples/widgets/doc/src/stardelegate.qdoc
index dcc7080456..44d17662ca 100644
--- a/examples/widgets/doc/src/stardelegate.qdoc
+++ b/examples/widgets/doc/src/stardelegate.qdoc
@@ -37,7 +37,7 @@
When displaying data in a QListView, QTableView, or QTreeView,
the individual items are drawn by a
\l{Delegate Classes}{delegate}. Also, when the user starts
- editing an item (e.g., by double-clicking the item), the delegate
+ editing an item (for example, by double-clicking the item), the delegate
provides an editor widget that is placed on top of the item while
editing takes place.
@@ -96,9 +96,9 @@
QItemDelegate paint it for us. This ensures that the \c
StarDelegate can handle the most common data types.
- In the case where the item is a \c StarRating, we draw the
- background if the item is selected, and we draw the item using \c
- StarRating::paint(), which we will review later.
+ If the item is a \c StarRating, we draw the background if the
+ item is selected, and we draw the item using \c StarRating::paint(),
+ which we will review later.
\c{StartRating}s can be stored in a QVariant thanks to the
Q_DECLARE_METATYPE() macro appearing in \c starrating.h. More on
@@ -133,8 +133,8 @@
We simply call \c setStarRating() on the editor.
The \l{QAbstractItemDelegate::}{setModelData()} function is
- called when editing is finished, to commit data from the editor
- to the model:
+ called to commit data from the editor to the model when editing
+ is finished:
\snippet itemviews/stardelegate/stardelegate.cpp 4
@@ -210,7 +210,7 @@
current rating, and \c myMaxStarCount stores the highest possible
rating (typically 5).
- The Q_DECLARE_METATYPE() macro makes the type \c StarRating known
+ The \c Q_DECLARE_METATYPE() macro makes the type \c StarRating known
to QVariant, making it possible to store \c StarRating values in
QVariant.
@@ -283,7 +283,7 @@
\list
\li It is possible to open editors programmatically by calling
QAbstractItemView::edit(), instead of relying on edit
- triggers. This could be use to support other edit triggers
+ triggers. This could be used to support other edit triggers
than those offered by the QAbstractItemView::EditTrigger enum.
For example, in the Star Delegate example, hovering over an
item with the mouse might make sense as a way to pop up an
diff --git a/examples/widgets/doc/src/stylesheet.qdoc b/examples/widgets/doc/src/stylesheet.qdoc
index 0016836f0d..a86b697059 100644
--- a/examples/widgets/doc/src/stylesheet.qdoc
+++ b/examples/widgets/doc/src/stylesheet.qdoc
@@ -33,5 +33,56 @@
\borderedimage stylesheet-pagefold.png
\caption Screen Shot of the Pagefold style sheet
+
+ The Style Sheet example shows how widgets can be styled using Qt Style Sheets.
+ You can open the style editor by selecting \uicontrol File > \uicontrol Edit Style Sheet,
+ to select an existing style sheet or design your own style and load it.
+
+ The Style Sheet example consists of 2 classes:
+ \list
+ \li \c MainWindow
+ \li \c StyleSheetEditor
+ \endlist
+
+
+ \section1 MainWindow Class
+
+ \c MainWindow inherits QWidget, and is the application's main window defined in
+ \c mainwindow.ui. The style of \c MainWindow can be modified with \l StyleSheetEditor.
+
+
+ \section1 StyleSheetEditor Class
+
+ \c StyleSheetEditor enables you to open an editor where you can load an existing style sheet.
+ It is also possible to define a new stylesheet and load it. Its layout is defined in
+ \c stylesheeteditor.ui.
+
+ \quotefromfile widgets/stylesheet/stylesheeteditor.cpp
+ \skipto on_styleCombo_activated
+ \printline on_styleCombo_activated
+
+ Sets the specified \a styleName and grays the \c applyButton.
+
+ \skipto on_styleSheetCombo_activated
+ \printline on_styleSheetCombo_activated
+
+ Loads the stylesheet from \c styleSheetName.
+
+ \skipto on_styleTextEdit_textChanged()
+ \printline on_styleTextEdit_textChanged()
+
+ Enables the \c applyButton when the text in the buffer has changed.
+
+ \skipto on_applyButton_clicked()
+ \printline on_applyButton_clicked()
+
+ Sets the stylesheet properties in \l qApp and disables the \c applyButton.
+
+ \skipto loadStyleSheet(const QString &sheetName)
+ \printline loadStyleSheet(const QString &sheetName)
+
+ Loads the specified \a sheetName, and sets its properties in
+ \l qApp.
+
*/
diff --git a/examples/widgets/doc/src/tablet.qdoc b/examples/widgets/doc/src/tablet.qdoc
index 88fdefa68f..2b11020c07 100644
--- a/examples/widgets/doc/src/tablet.qdoc
+++ b/examples/widgets/doc/src/tablet.qdoc
@@ -206,8 +206,7 @@
\snippet widgets/tablet/tabletcanvas.cpp 0
- In the constructor we initialize our class variables. We need
- to draw the background of our pixmap, as the default is gray.
+ In the constructor we initialize most of our class variables.
Here is the implementation of \c saveImage():
@@ -247,7 +246,15 @@
\snippet widgets/tablet/tabletcanvas.cpp 4
- We simply draw the pixmap to the top left of the widget.
+ The first time Qt calls paintEvent(), m_pixmap is default-constructed, so
+ QPixmap::isNull() returns \c true. Now that we know which screen we will be
+ rendering to, we can create a pixmap with the appropriate resolution.
+ The size of the pixmap with which we fill the window depends on the screen
+ resolution, as the example does not support zoom; and it may be that one
+ screen is \l {High DPI Displays}{high DPI} while another is not. We need to
+ draw the background too, as the default is gray.
+
+ After that, we simply draw the pixmap to the top left of the widget.
Here is the implementation of \c paintPixmap():
diff --git a/examples/widgets/doc/src/validators.qdoc b/examples/widgets/doc/src/validators.qdoc
index f3f4dc5e63..bbb2e5f7b6 100644
--- a/examples/widgets/doc/src/validators.qdoc
+++ b/examples/widgets/doc/src/validators.qdoc
@@ -31,4 +31,6 @@
\ingroup examples-widgets
\brief The Validators example shows the signal emission behavior of input
validators.
+
+ \borderedimage validators.png
*/