Doc: Move some remaining files over for modularization.
The files in this change were still in qtbase/doc/src or required for it. qtbase/doc/src should now only contain example documentation and images for the example documentation. Change-Id: Ia7ca8e7fd2b316e77c706a08df71303bc8294213 Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
39
src/corelib/doc/src/io.qdoc
Normal file
@ -0,0 +1,39 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** GNU Free Documentation License
|
||||
** Alternatively, this file may be used under the terms of the GNU Free
|
||||
** Documentation License version 1.3 as published by the Free Software
|
||||
** Foundation and appearing in the file included in the packaging of
|
||||
** this file.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms
|
||||
** and conditions contained in a signed written agreement between you
|
||||
** and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\group io
|
||||
\title Input/Output and Networking
|
||||
\ingroup groups
|
||||
|
||||
\brief Classes providing file input and output along with directory and
|
||||
network handling.
|
||||
|
||||
These classes are used to handle input and output to and from external
|
||||
devices, processes, files etc. as well as manipulating files and directories.
|
||||
*/
|
||||
|
@ -25,18 +25,6 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\group io
|
||||
\title Input/Output and Networking
|
||||
\ingroup groups
|
||||
|
||||
\brief Classes providing file input and output along with directory and
|
||||
network handling.
|
||||
|
||||
These classes are used to handle input and output to and from external
|
||||
devices, processes, files etc. as well as manipulating files and directories.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\page resources.html
|
||||
\title The Qt Resource System
|
||||
@ -89,14 +77,14 @@
|
||||
is \c images/cut.png. This can be changed using the \c file tag's
|
||||
\c alias attribute:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_resources.qdoc 0
|
||||
\snippet code/doc_src_resources.qdoc 0
|
||||
|
||||
The file is then accessible as \c :/cut-img.png from the
|
||||
application. It is also possible to specify a path prefix for all
|
||||
files in the \c .qrc file using the \c qresource tag's \c prefix
|
||||
attribute:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_resources.qdoc 1
|
||||
\snippet code/doc_src_resources.qdoc 1
|
||||
|
||||
In this case, the file is accessible as \c
|
||||
:/myresources/cut-img.png.
|
||||
@ -106,7 +94,7 @@
|
||||
attribute to the \c qresource tag, specifying a suitable locale
|
||||
string. For example:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_resources.qdoc 2
|
||||
\snippet code/doc_src_resources.qdoc 2
|
||||
|
||||
If the user's locale is French (i.e., QLocale::system().name() returns
|
||||
"fr_FR"), \c :/cut.jpg becomes a reference to the \c cut_fr.jpg
|
||||
@ -126,11 +114,11 @@
|
||||
For example, a set of resource data specified in a \c .qrc file can be
|
||||
compiled in the following way:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_resources.qdoc 3
|
||||
\snippet code/doc_src_resources.qdoc 3
|
||||
|
||||
In the application, this resource would be registered with code like this:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_resources.cpp 4
|
||||
\snippet code/doc_src_resources.cpp 4
|
||||
|
||||
\section2 Compiled-In Resources
|
||||
|
||||
@ -138,7 +126,7 @@
|
||||
mentioned in the application's \c .pro file so that \c qmake knows
|
||||
about it. For example:
|
||||
|
||||
\snippet examples/mainwindows/application/application.pro 0
|
||||
\snippet mainwindows/application/application.pro 0
|
||||
|
||||
\c qmake will produce make rules to generate a file called \c
|
||||
qrc_application.cpp that is linked into the application. This
|
||||
@ -183,7 +171,7 @@
|
||||
pass a resource path instead of a file name to the QIcon, QImage,
|
||||
or QPixmap constructor:
|
||||
|
||||
\snippet examples/mainwindows/application/mainwindow.cpp 21
|
||||
\snippet mainwindows/application/mainwindow.cpp 21
|
||||
|
||||
See the \l{mainwindows/application}{Application} example for an
|
||||
actual application that uses Qt's resource system to store its
|
||||
@ -205,7 +193,7 @@
|
||||
Q_INIT_RESOURCE() with the base name of the \c .qrc file. For
|
||||
example:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_resources.cpp 5
|
||||
\snippet code/doc_src_resources.cpp 5
|
||||
|
||||
Similarly, if you must unload a set of resources explicitly
|
||||
(because a plugin is being unloaded or the resources are not valid
|
@ -737,7 +737,7 @@ void qWinMessageHandler2(QtMsgType t, const QMessageLogContext &context,
|
||||
This is a typedef for a pointer to a function with the following
|
||||
signature:
|
||||
|
||||
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 7
|
||||
\snippet code/src_corelib_global_qglobal.cpp 7
|
||||
|
||||
This typedef is deprecated, you should use QtMessageHandler instead.
|
||||
\sa QtMsgType, QtMessageHandler, qInstallMsgHandler(), qInstallMessageHandler()
|
||||
@ -751,7 +751,7 @@ void qWinMessageHandler2(QtMsgType t, const QMessageLogContext &context,
|
||||
This is a typedef for a pointer to a function with the following
|
||||
signature:
|
||||
|
||||
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 49
|
||||
\snippet code/src_corelib_global_qglobal.cpp 49
|
||||
|
||||
\sa QtMsgType, qInstallMessageHandler()
|
||||
*/
|
||||
@ -785,7 +785,7 @@ void qWinMessageHandler2(QtMsgType t, const QMessageLogContext &context,
|
||||
|
||||
Example:
|
||||
|
||||
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 23
|
||||
\snippet code/src_corelib_global_qglobal.cpp 23
|
||||
|
||||
\sa QtMessageHandler, QtMsgType, qDebug(), qWarning(), qCritical(), qFatal(),
|
||||
{Debugging Techniques}
|
||||
|
@ -146,12 +146,12 @@ void QFileDevicePrivate::setError(QFileDevice::FileError err, int errNum)
|
||||
handling considerably. It is possible to force permission checking
|
||||
on NTFS by including the following code in your source:
|
||||
|
||||
\snippet doc/src/snippets/ntfsp.cpp 0
|
||||
\snippet ntfsp.cpp 0
|
||||
|
||||
Permission checking is then turned on and off by incrementing and
|
||||
decrementing \c qt_ntfs_permission_lookup by 1.
|
||||
|
||||
\snippet doc/src/snippets/ntfsp.cpp 1
|
||||
\snippet ntfsp.cpp 1
|
||||
*/
|
||||
|
||||
//************* QFileDevice
|
||||
|
@ -511,7 +511,7 @@ QString QUrlQuery::query(QUrl::ComponentFormattingOptions encoding) const
|
||||
If \a valueDelimiter is set to '(' and \a pairDelimiter is ')',
|
||||
the above query string would instead be represented like this:
|
||||
|
||||
\snippet doc/src/snippets/code/src_corelib_io_qurl.cpp 4
|
||||
\snippet code/src_corelib_io_qurl.cpp 4
|
||||
|
||||
\note Non-standard delimiters should be chosen from among what RFC 3986 calls
|
||||
"sub-delimiters". They are:
|
||||
|
@ -838,7 +838,7 @@ void QHashData::checkSanity()
|
||||
operator==() and a qHash() implementation.
|
||||
|
||||
Example:
|
||||
\snippet doc/src/snippets/code/src_corelib_tools_qhash.cpp 13
|
||||
\snippet code/src_corelib_tools_qhash.cpp 13
|
||||
|
||||
In the example above, we've relied on Qt's global qHash(const
|
||||
QString &, uint) to give us a hash value for the employee's name, and
|
||||
|
@ -404,8 +404,8 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegExp &r
|
||||
|
||||
For example:
|
||||
|
||||
\snippet doc/src/snippets/qstringlist/main.cpp 5
|
||||
\snippet doc/src/snippets/qstringlist/main.cpp 16
|
||||
\snippet qstringlist/main.cpp 5
|
||||
\snippet qstringlist/main.cpp 16
|
||||
|
||||
For regular expressions that contain capturing groups,
|
||||
occurrences of \b{\\1}, \b{\\2}, ..., in \a after are
|
||||
@ -413,8 +413,8 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegExp &r
|
||||
|
||||
For example:
|
||||
|
||||
\snippet doc/src/snippets/qstringlist/main.cpp 5
|
||||
\snippet doc/src/snippets/qstringlist/main.cpp 17
|
||||
\snippet qstringlist/main.cpp 5
|
||||
\snippet qstringlist/main.cpp 17
|
||||
*/
|
||||
void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegularExpression &re, const QString &after)
|
||||
{
|
||||
|
BIN
src/gui/doc/images/qrect-diagram-zero.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
src/gui/doc/images/qrectf-diagram-one.png
Normal file
After Width: | Height: | Size: 9.4 KiB |
BIN
src/gui/doc/images/qrectf-diagram-three.png
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
src/gui/doc/images/qrectf-diagram-two.png
Normal file
After Width: | Height: | Size: 9.2 KiB |
@ -97,10 +97,10 @@
|
||||
|
||||
\row
|
||||
\li
|
||||
\snippet doc/src/snippets/code/doc_src_coordsys.cpp 0
|
||||
\snippet code/doc_src_coordsys.cpp 0
|
||||
|
||||
\li
|
||||
\snippet doc/src/snippets/code/doc_src_coordsys.cpp 1
|
||||
\snippet code/doc_src_coordsys.cpp 1
|
||||
\endtable
|
||||
|
||||
When rendering with a pen with an even number of pixels, the
|
||||
@ -163,10 +163,10 @@
|
||||
\row
|
||||
\li
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_coordsys.cpp 2
|
||||
\snippet code/doc_src_coordsys.cpp 2
|
||||
|
||||
\li
|
||||
\snippet doc/src/snippets/code/doc_src_coordsys.cpp 3
|
||||
\snippet code/doc_src_coordsys.cpp 3
|
||||
\endtable
|
||||
|
||||
\section1 Transformations
|
||||
@ -238,7 +238,7 @@
|
||||
\row
|
||||
\li {2,1}
|
||||
|
||||
\snippet examples/widgets/analogclock/analogclock.cpp 9
|
||||
\snippet widgets/analogclock/analogclock.cpp 9
|
||||
|
||||
First, we set up the painter. We translate the coordinate system
|
||||
so that point (0, 0) is in the widget's center, instead of being
|
||||
@ -253,7 +253,7 @@
|
||||
|
||||
See also the \l {Window-Viewport Conversion} section.
|
||||
|
||||
\snippet examples/widgets/analogclock/analogclock.cpp 18
|
||||
\snippet widgets/analogclock/analogclock.cpp 18
|
||||
|
||||
We draw the clock's hour hand by rotating the coordinate system
|
||||
and calling QPainter::drawConvexPolygon(). Thank's to the
|
||||
@ -268,14 +268,14 @@
|
||||
the code guarantees that the code that follows won't be disturbed
|
||||
by the transformations we've used.
|
||||
|
||||
\snippet examples/widgets/analogclock/analogclock.cpp 24
|
||||
\snippet widgets/analogclock/analogclock.cpp 24
|
||||
|
||||
We do the same for the clock's minute hand, which is defined by
|
||||
the four points (1, 0), (0, 1), (-1, 0), and (0, -40). These
|
||||
coordinates specify a hand that is thinner and longer than the
|
||||
minute hand.
|
||||
|
||||
\snippet examples/widgets/analogclock/analogclock.cpp 27
|
||||
\snippet widgets/analogclock/analogclock.cpp 27
|
||||
|
||||
Finally, we draw the clock face, which consists of twelve short
|
||||
lines at 30-degree intervals. At the end of that, the painter is
|
||||
@ -319,7 +319,7 @@
|
||||
-50) to (50, 50) with (0, 0) in the center by calling the
|
||||
QPainter::setWindow() function:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_coordsys.cpp 4
|
||||
\snippet code/doc_src_coordsys.cpp 4
|
||||
|
||||
Now, the logical coordinates (-50,-50) correspond to the paint
|
||||
device's physical coordinates (0, 0). Independent of the paint
|
||||
@ -333,7 +333,7 @@
|
||||
viewport and "window" maintain the same aspect ratio to prevent
|
||||
deformation:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_coordsys.cpp 5
|
||||
\snippet code/doc_src_coordsys.cpp 5
|
||||
|
||||
If we make the logical coordinate system a square, we should also
|
||||
make the viewport a square using the QPainter::setViewport()
|
||||
|
@ -177,7 +177,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
|
||||
more modifiers, such as Qt::SHIFT, Qt::CTRL, Qt::ALT and Qt::META.
|
||||
\endlist
|
||||
|
||||
For example, \gui{Ctrl P} might be a sequence used as a shortcut for
|
||||
For example, \uicontrol{Ctrl P} might be a sequence used as a shortcut for
|
||||
printing a document, and can be specified in any of the following
|
||||
ways:
|
||||
|
||||
@ -185,8 +185,8 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
|
||||
|
||||
Note that, for letters, the case used in the specification string
|
||||
does not matter. In the above examples, the user does not need to
|
||||
hold down the \key{Shift} key to activate a shortcut specified
|
||||
with "Ctrl+P". However, for other keys, the use of \key{Shift} as
|
||||
hold down the \uicontrol{Shift} key to activate a shortcut specified
|
||||
with "Ctrl+P". However, for other keys, the use of \uicontrol{Shift} as
|
||||
an unspecified extra modifier key can lead to confusion for users
|
||||
of an application whose keyboards have different layouts to those
|
||||
used by the developers. See the \l{Keyboard Layout Issues} section
|
||||
@ -207,9 +207,9 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
|
||||
as Qt::Key_A.
|
||||
|
||||
\b{Note:} On Mac OS X, references to "Ctrl", Qt::CTRL, Qt::Control
|
||||
and Qt::ControlModifier correspond to the \key Command keys on the
|
||||
and Qt::ControlModifier correspond to the \uicontrol Command keys on the
|
||||
Macintosh keyboard, and references to "Meta", Qt::META, Qt::Meta and
|
||||
Qt::MetaModifier correspond to the \key Control keys. Developers on
|
||||
Qt::MetaModifier correspond to the \uicontrol Control keys. Developers on
|
||||
Mac OS X can use the same shortcut descriptions across all platforms,
|
||||
and their applications will automatically work as expected on Mac OS X.
|
||||
|
||||
@ -220,9 +220,9 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
|
||||
setting up actions in a typical application. The table below shows
|
||||
some common key sequences that are often used for these standard
|
||||
shortcuts by applications on four widely-used platforms. Note
|
||||
that on Mac OS X, the \key Ctrl value corresponds to the \key
|
||||
Command keys on the Macintosh keyboard, and the \key Meta value
|
||||
corresponds to the \key Control keys.
|
||||
that on Mac OS X, the \uicontrol Ctrl value corresponds to the \uicontrol
|
||||
Command keys on the Macintosh keyboard, and the \uicontrol Meta value
|
||||
corresponds to the \uicontrol Control keys.
|
||||
|
||||
\table
|
||||
\header \li StandardKey \li Windows \li Mac OS X \li KDE \li GNOME
|
||||
@ -302,23 +302,23 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
|
||||
|
||||
Many key sequence specifications are chosen by developers based on the
|
||||
layout of certain types of keyboard, rather than choosing keys that
|
||||
represent the first letter of an action's name, such as \key{Ctrl S}
|
||||
("Ctrl+S") or \key{Ctrl C} ("Ctrl+C").
|
||||
represent the first letter of an action's name, such as \uicontrol{Ctrl S}
|
||||
("Ctrl+S") or \uicontrol{Ctrl C} ("Ctrl+C").
|
||||
Additionally, because certain symbols can only be entered with the
|
||||
help of modifier keys on certain keyboard layouts, key sequences intended
|
||||
for use with one keyboard layout may map to a different key, map to no
|
||||
keys at all, or require an additional modifier key to be used on
|
||||
different keyboard layouts.
|
||||
|
||||
For example, the shortcuts, \key{Ctrl plus} and \key{Ctrl minus}, are often
|
||||
For example, the shortcuts, \uicontrol{Ctrl plus} and \uicontrol{Ctrl minus}, are often
|
||||
used as shortcuts for zoom operations in graphics applications, and these
|
||||
may be specified as "Ctrl++" and "Ctrl+-" respectively. However, the way
|
||||
these shortcuts are specified and interpreted depends on the keyboard layout.
|
||||
Users of Norwegian keyboards will note that the \key{+} and \key{-} keys
|
||||
Users of Norwegian keyboards will note that the \uicontrol{+} and \uicontrol{-} keys
|
||||
are not adjacent on the keyboard, but will still be able to activate both
|
||||
shortcuts without needing to press the \key{Shift} key. However, users
|
||||
with British keyboards will need to hold down the \key{Shift} key
|
||||
to enter the \key{+} symbol, making the shortcut effectively the same as
|
||||
shortcuts without needing to press the \uicontrol{Shift} key. However, users
|
||||
with British keyboards will need to hold down the \uicontrol{Shift} key
|
||||
to enter the \uicontrol{+} symbol, making the shortcut effectively the same as
|
||||
"Ctrl+Shift+=".
|
||||
|
||||
Although some developers might resort to fully specifying all the modifiers
|
||||
@ -327,9 +327,9 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
|
||||
|
||||
For example, a developer using a British keyboard may decide to specify
|
||||
"Ctrl+Shift+=" as the key sequence in order to create a shortcut that
|
||||
coincidentally behaves in the same way as \key{Ctrl plus}. However, the
|
||||
\key{=} key needs to be accessed using the \key{Shift} key on Norwegian
|
||||
keyboard, making the required shortcut effectively \key{Ctrl Shift Shift =}
|
||||
coincidentally behaves in the same way as \uicontrol{Ctrl plus}. However, the
|
||||
\uicontrol{=} key needs to be accessed using the \uicontrol{Shift} key on Norwegian
|
||||
keyboard, making the required shortcut effectively \uicontrol{Ctrl Shift Shift =}
|
||||
(an impossible key combination).
|
||||
|
||||
As a result, both human-readable strings and hard-coded key codes
|
||||
@ -351,7 +351,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
|
||||
key codes, can be created by using the multiple argument constructor,
|
||||
or by passing a human-readable string of comma-separated key sequences.
|
||||
|
||||
For example, the key sequence, \key{Ctrl X} followed by \key{Ctrl C}, can
|
||||
For example, the key sequence, \uicontrol{Ctrl X} followed by \uicontrol{Ctrl C}, can
|
||||
be specified using either of the following ways:
|
||||
|
||||
\snippet code/src_gui_kernel_qkeysequence.cpp 1
|
||||
|
@ -120,7 +120,7 @@ QT_BEGIN_NAMESPACE
|
||||
and QTextObjectInterface. QObject must be the first class
|
||||
inherited. For instance:
|
||||
|
||||
\snippet examples/richtext/textobject/svgtextobject.h 1
|
||||
\snippet richtext/textobject/svgtextobject.h 1
|
||||
|
||||
The data of a text object is usually stored in the QTextCharFormat
|
||||
using QTextCharFormat::setProperty(), and then retrieved with
|
||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
BIN
src/widgets/doc/images/columnview.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 84 KiB |
BIN
src/widgets/doc/images/listview.png
Executable file
After Width: | Height: | Size: 9.5 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
BIN
src/widgets/doc/images/modelview-combobox.png
Executable file
After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
BIN
src/widgets/doc/images/modelview-models.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
src/widgets/doc/images/modelview-overview.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
src/widgets/doc/images/modelview-roles.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
src/widgets/doc/images/modelview-tablemodel.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
src/widgets/doc/images/modelview-treemodel.png
Normal file
After Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
BIN
src/widgets/doc/images/selected-items1.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
src/widgets/doc/images/selected-items2.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
src/widgets/doc/images/selected-items3.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
src/widgets/doc/images/selection-extended.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
src/widgets/doc/images/selection-multi.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
src/widgets/doc/images/selection-single.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
BIN
src/widgets/doc/images/shareddirmodel.png
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
src/widgets/doc/images/sharedmodel-tableviews.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
src/widgets/doc/images/sharedselection-tableviews.png
Normal file
After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
BIN
src/widgets/doc/images/standard-views.png
Normal file
After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
BIN
src/widgets/doc/images/stringlistmodel.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
src/widgets/doc/images/tableview.png
Executable file
After Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
BIN
src/widgets/doc/images/widgets-tutorial-childwidget.png
Normal file
After Width: | Height: | Size: 8.3 KiB |
BIN
src/widgets/doc/images/widgets-tutorial-nestedlayouts.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
src/widgets/doc/images/widgets-tutorial-toplevel.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
src/widgets/doc/images/widgets-tutorial-windowlayout.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
@ -0,0 +1,76 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//! [0]
|
||||
QAbstractItemModel *model = index.model();
|
||||
//! [0]
|
||||
|
||||
|
||||
//! [1]
|
||||
QModelIndex index = model->index(row, column, ...);
|
||||
//! [1]
|
||||
|
||||
|
||||
//! [2]
|
||||
QModelIndex indexA = model->index(0, 0, QModelIndex());
|
||||
QModelIndex indexB = model->index(1, 1, QModelIndex());
|
||||
QModelIndex indexC = model->index(2, 1, QModelIndex());
|
||||
//! [2]
|
||||
|
||||
|
||||
//! [3]
|
||||
QModelIndex index = model->index(row, column, parent);
|
||||
//! [3]
|
||||
|
||||
|
||||
//! [4]
|
||||
QModelIndex indexA = model->index(0, 0, QModelIndex());
|
||||
QModelIndex indexC = model->index(2, 1, QModelIndex());
|
||||
//! [4]
|
||||
|
||||
|
||||
//! [5]
|
||||
QModelIndex indexB = model->index(1, 0, indexA);
|
||||
//! [5]
|
||||
|
||||
|
||||
//! [6]
|
||||
QVariant value = model->data(index, role);
|
||||
//! [6]
|
3
src/widgets/doc/snippets/itemselection/itemselection.pro
Normal file
@ -0,0 +1,3 @@
|
||||
HEADERS = model.h
|
||||
SOURCES = main.cpp \
|
||||
model.cpp
|
115
src/widgets/doc/snippets/itemselection/main.cpp
Normal file
@ -0,0 +1,115 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
main.cpp
|
||||
|
||||
A simple example that shows how selections can be used directly on a model.
|
||||
It shows the result of some selections made using a table view.
|
||||
*/
|
||||
|
||||
#include <QApplication>
|
||||
#include <QItemSelection>
|
||||
#include <QItemSelectionModel>
|
||||
#include <QTableView>
|
||||
|
||||
#include "model.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
//! [0]
|
||||
TableModel *model = new TableModel(8, 4, &app);
|
||||
|
||||
QTableView *table = new QTableView(0);
|
||||
table->setModel(model);
|
||||
|
||||
QItemSelectionModel *selectionModel = table->selectionModel();
|
||||
//! [0] //! [1]
|
||||
QModelIndex topLeft;
|
||||
QModelIndex bottomRight;
|
||||
|
||||
topLeft = model->index(0, 0, QModelIndex());
|
||||
bottomRight = model->index(5, 2, QModelIndex());
|
||||
//! [1]
|
||||
|
||||
//! [2]
|
||||
QItemSelection selection(topLeft, bottomRight);
|
||||
selectionModel->select(selection, QItemSelectionModel::Select);
|
||||
//! [2]
|
||||
|
||||
//! [3]
|
||||
QItemSelection toggleSelection;
|
||||
|
||||
topLeft = model->index(2, 1, QModelIndex());
|
||||
bottomRight = model->index(7, 3, QModelIndex());
|
||||
toggleSelection.select(topLeft, bottomRight);
|
||||
|
||||
selectionModel->select(toggleSelection, QItemSelectionModel::Toggle);
|
||||
//! [3]
|
||||
|
||||
//! [4]
|
||||
QItemSelection columnSelection;
|
||||
|
||||
topLeft = model->index(0, 1, QModelIndex());
|
||||
bottomRight = model->index(0, 2, QModelIndex());
|
||||
|
||||
columnSelection.select(topLeft, bottomRight);
|
||||
|
||||
selectionModel->select(columnSelection,
|
||||
QItemSelectionModel::Select | QItemSelectionModel::Columns);
|
||||
|
||||
QItemSelection rowSelection;
|
||||
|
||||
topLeft = model->index(0, 0, QModelIndex());
|
||||
bottomRight = model->index(1, 0, QModelIndex());
|
||||
|
||||
rowSelection.select(topLeft, bottomRight);
|
||||
|
||||
selectionModel->select(rowSelection,
|
||||
QItemSelectionModel::Select | QItemSelectionModel::Rows);
|
||||
//! [4]
|
||||
|
||||
table->setWindowTitle("Selected items in a table model");
|
||||
table->show();
|
||||
table->resize(460, 280);
|
||||
return app.exec();
|
||||
}
|
238
src/widgets/doc/snippets/itemselection/model.cpp
Normal file
@ -0,0 +1,238 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
model.cpp
|
||||
|
||||
Provides a table model for use in various examples.
|
||||
*/
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
#include "model.h"
|
||||
|
||||
/*!
|
||||
Constructs a table model with at least one row and one column.
|
||||
*/
|
||||
|
||||
TableModel::TableModel(int rows, int columns, QObject *parent)
|
||||
: QAbstractTableModel(parent)
|
||||
{
|
||||
QStringList newList;
|
||||
|
||||
for (int column = 0; column < qMax(1, columns); ++column) {
|
||||
newList.append("");
|
||||
}
|
||||
|
||||
for (int row = 0; row < qMax(1, rows); ++row) {
|
||||
rowList.append(newList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Returns the number of items in the row list as the number of rows
|
||||
in the model.
|
||||
*/
|
||||
|
||||
int TableModel::rowCount(const QModelIndex &/*parent*/) const
|
||||
{
|
||||
return rowList.size();
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the number of items in the first list item as the number of
|
||||
columns in the model. All rows should have the same number of columns.
|
||||
*/
|
||||
|
||||
int TableModel::columnCount(const QModelIndex &/*parent*/) const
|
||||
{
|
||||
return rowList[0].size();
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns an appropriate value for the requested data.
|
||||
If the view requests an invalid index, an invalid variant is returned.
|
||||
Any valid index that corresponds to a string in the list causes that
|
||||
string to be returned for the display role; otherwise an invalid variant
|
||||
is returned.
|
||||
*/
|
||||
|
||||
QVariant TableModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
if (role == Qt::DisplayRole)
|
||||
return rowList[index.row()][index.column()];
|
||||
else
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the appropriate header string depending on the orientation of
|
||||
the header and the section. If anything other than the display role is
|
||||
requested, we return an invalid variant.
|
||||
*/
|
||||
|
||||
QVariant TableModel::headerData(int section, Qt::Orientation orientation,
|
||||
int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
if (orientation == Qt::Horizontal)
|
||||
return QString("Column %1").arg(section);
|
||||
else
|
||||
return QString("Row %1").arg(section);
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns an appropriate value for the item's flags. Valid items are
|
||||
enabled, selectable, and editable.
|
||||
*/
|
||||
|
||||
Qt::ItemFlags TableModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return Qt::ItemIsEnabled;
|
||||
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
|
||||
}
|
||||
|
||||
/*!
|
||||
Changes an item in the model, but only if the following conditions
|
||||
are met:
|
||||
|
||||
* The index supplied is valid.
|
||||
* The role associated with editing text is specified.
|
||||
|
||||
The dataChanged() signal is emitted if the item is changed.
|
||||
*/
|
||||
|
||||
bool TableModel::setData(const QModelIndex &index,
|
||||
const QVariant &value, int role)
|
||||
{
|
||||
if (!index.isValid() || role != Qt::EditRole)
|
||||
return false;
|
||||
|
||||
rowList[index.row()][index.column()] = value.toString();
|
||||
emit dataChanged(index, index);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
Inserts a number of rows into the model at the specified position.
|
||||
*/
|
||||
|
||||
bool TableModel::insertRows(int position, int rows, const QModelIndex &parent)
|
||||
{
|
||||
int columns = columnCount();
|
||||
beginInsertRows(parent, position, position + rows - 1);
|
||||
|
||||
for (int row = 0; row < rows; ++row) {
|
||||
QStringList items;
|
||||
for (int column = 0; column < columns; ++column)
|
||||
items.append("");
|
||||
rowList.insert(position, items);
|
||||
}
|
||||
|
||||
endInsertRows();
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
Inserts a number of columns into the model at the specified position.
|
||||
Each entry in the list is extended in turn with the required number of
|
||||
empty strings.
|
||||
*/
|
||||
|
||||
bool TableModel::insertColumns(int position, int columns,
|
||||
const QModelIndex &parent)
|
||||
{
|
||||
int rows = rowCount();
|
||||
beginInsertColumns(parent, position, position + columns - 1);
|
||||
|
||||
for (int row = 0; row < rows; ++row) {
|
||||
for (int column = position; column < columns; ++column) {
|
||||
rowList[row].insert(position, "");
|
||||
}
|
||||
}
|
||||
|
||||
endInsertColumns();
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
Removes a number of rows from the model at the specified position.
|
||||
*/
|
||||
|
||||
bool TableModel::removeRows(int position, int rows, const QModelIndex &parent)
|
||||
{
|
||||
beginRemoveRows(parent, position, position + rows - 1);
|
||||
|
||||
for (int row = 0; row < rows; ++row) {
|
||||
rowList.removeAt(position);
|
||||
}
|
||||
|
||||
endRemoveRows();
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
Removes a number of columns from the model at the specified position.
|
||||
Each row is shortened by the number of columns specified.
|
||||
*/
|
||||
|
||||
bool TableModel::removeColumns(int position, int columns,
|
||||
const QModelIndex &parent)
|
||||
{
|
||||
int rows = rowCount();
|
||||
beginRemoveColumns(parent, position, position + columns - 1);
|
||||
|
||||
for (int row = 0; row < rows; ++row) {
|
||||
for (int column = 0; column < columns; ++column) {
|
||||
rowList[row].removeAt(position);
|
||||
}
|
||||
}
|
||||
|
||||
endRemoveColumns();
|
||||
return true;
|
||||
}
|
@ -38,48 +38,37 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//! [0]
|
||||
bool MyScreenSaver::save( int level )
|
||||
#ifndef MODEL_H
|
||||
#define MODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QStringList>
|
||||
#include <QVariant>
|
||||
|
||||
class TableModel : public QAbstractTableModel
|
||||
{
|
||||
switch ( level ) {
|
||||
case 0:
|
||||
if ( dim_enabled ) {
|
||||
// dim the screen
|
||||
}
|
||||
return true;
|
||||
case 1:
|
||||
if ( screenoff_enabled ) {
|
||||
// turn off the screen
|
||||
}
|
||||
return true;
|
||||
case 2:
|
||||
if ( suspend_enabled ) {
|
||||
// suspend
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Q_OBJECT
|
||||
|
||||
...
|
||||
public:
|
||||
TableModel(int rows = 1, int columns = 1, QObject *parent = 0);
|
||||
|
||||
int timings[4];
|
||||
timings[0] = 5000; // dim after 5 seconds
|
||||
timings[1] = 10000; // light off after 15 seconds
|
||||
timings[2] = 45000; // suspend after 60 seconds
|
||||
timings[3] = 0;
|
||||
QWSServer::setScreenSaverIntervals( timings );
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const;
|
||||
|
||||
// ignore the key/mouse event that turns on the screen
|
||||
int blocklevel = 1;
|
||||
if ( !screenoff_enabled ) {
|
||||
// screenoff is disabled, ignore the key/mouse event that wakes from suspend
|
||||
blocklevel = 2;
|
||||
if ( !suspend_enabled ) {
|
||||
// suspend is disabled, never ignore events
|
||||
blocklevel = -1;
|
||||
}
|
||||
}
|
||||
QWSServer::setScreenSaverBlockLevel( blocklevel );
|
||||
//! [0]
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
bool setData(const QModelIndex &index, const QVariant &value,
|
||||
int role = Qt::EditRole);
|
||||
|
||||
bool insertRows(int position, int rows, const QModelIndex &parent = QModelIndex());
|
||||
bool insertColumns(int position, int columns, const QModelIndex &parent = QModelIndex());
|
||||
bool removeRows(int position, int rows, const QModelIndex &parent = QModelIndex());
|
||||
bool removeColumns(int position, int columns, const QModelIndex &parent = QModelIndex());
|
||||
|
||||
private:
|
||||
QList<QStringList> rowList;
|
||||
};
|
||||
|
||||
#endif
|
@ -38,11 +38,14 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//! [0]
|
||||
[screen driver][:driver specific options][:display number]
|
||||
//! [0]
|
||||
#include <QtGui>
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
//! [1]
|
||||
Mach64:/dev/fb1:2
|
||||
//! [1]
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
MainWindow *window = new MainWindow;
|
||||
window->show();
|
||||
return app.exec();
|
||||
}
|
83
src/widgets/doc/snippets/qlistview-dnd/mainwindow.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "model.h"
|
||||
|
||||
MainWindow::MainWindow()
|
||||
{
|
||||
QMenu *fileMenu = new QMenu(tr("&File"));
|
||||
|
||||
QAction *quitAction = fileMenu->addAction(tr("E&xit"));
|
||||
quitAction->setShortcut(tr("Ctrl+Q"));
|
||||
|
||||
menuBar()->addMenu(fileMenu);
|
||||
|
||||
// For convenient quoting:
|
||||
//! [0]
|
||||
QListView *listView = new QListView(this);
|
||||
listView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
listView->setDragEnabled(true);
|
||||
listView->setAcceptDrops(true);
|
||||
listView->setDropIndicatorShown(true);
|
||||
//! [0]
|
||||
|
||||
this->listView = listView;
|
||||
|
||||
connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
|
||||
|
||||
setupListItems();
|
||||
|
||||
setCentralWidget(listView);
|
||||
setWindowTitle(tr("List View"));
|
||||
}
|
||||
|
||||
void MainWindow::setupListItems()
|
||||
{
|
||||
QStringList items;
|
||||
items << tr("Oak") << tr("Fir") << tr("Pine") << tr("Birch") << tr("Hazel")
|
||||
<< tr("Redwood") << tr("Sycamore") << tr("Chestnut")
|
||||
<< tr("Mahogany");
|
||||
|
||||
DragDropListModel *model = new DragDropListModel(items, this);
|
||||
listView->setModel(model);
|
||||
}
|
61
src/widgets/doc/snippets/qlistview-dnd/mainwindow.h
Normal file
@ -0,0 +1,61 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef WINDOW_H
|
||||
#define WINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
class QListView;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow();
|
||||
|
||||
private:
|
||||
void setupListItems();
|
||||
|
||||
QListView *listView;
|
||||
};
|
||||
|
||||
#endif
|
167
src/widgets/doc/snippets/qlistview-dnd/model.cpp
Normal file
@ -0,0 +1,167 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of an example program for Qt.
|
||||
** EDITIONS: NOLIMITS
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
model.cpp
|
||||
|
||||
A simple model that uses a QStringList as its data source.
|
||||
*/
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
#include "model.h"
|
||||
|
||||
DragDropListModel::DragDropListModel(const QStringList &strings,
|
||||
QObject *parent)
|
||||
: QStringListModel(strings, parent)
|
||||
{
|
||||
}
|
||||
|
||||
//! [0]
|
||||
bool DragDropListModel::dropMimeData(const QMimeData *data,
|
||||
Qt::DropAction action, int row, int column, const QModelIndex &parent)
|
||||
{
|
||||
if (action == Qt::IgnoreAction)
|
||||
return true;
|
||||
|
||||
if (!data->hasFormat("application/vnd.text.list"))
|
||||
return false;
|
||||
|
||||
if (column > 0)
|
||||
//! [0] //! [1]
|
||||
return false;
|
||||
//! [1]
|
||||
|
||||
//! [2]
|
||||
int beginRow;
|
||||
|
||||
if (row != -1)
|
||||
beginRow = row;
|
||||
//! [2] //! [3]
|
||||
else if (parent.isValid())
|
||||
beginRow = parent.row();
|
||||
//! [3] //! [4]
|
||||
else
|
||||
beginRow = rowCount(QModelIndex());
|
||||
//! [4]
|
||||
|
||||
//! [5]
|
||||
QByteArray encodedData = data->data("application/vnd.text.list");
|
||||
QDataStream stream(&encodedData, QIODevice::ReadOnly);
|
||||
QStringList newItems;
|
||||
int rows = 0;
|
||||
|
||||
while (!stream.atEnd()) {
|
||||
QString text;
|
||||
stream >> text;
|
||||
newItems << text;
|
||||
++rows;
|
||||
}
|
||||
//! [5]
|
||||
|
||||
//! [6]
|
||||
insertRows(beginRow, rows, QModelIndex());
|
||||
foreach (const QString &text, newItems) {
|
||||
QModelIndex idx = index(beginRow, 0, QModelIndex());
|
||||
setData(idx, text);
|
||||
beginRow++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
//! [6]
|
||||
|
||||
//! [7]
|
||||
Qt::ItemFlags DragDropListModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
Qt::ItemFlags defaultFlags = QStringListModel::flags(index);
|
||||
|
||||
if (index.isValid())
|
||||
return Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | defaultFlags;
|
||||
else
|
||||
return Qt::ItemIsDropEnabled | defaultFlags;
|
||||
}
|
||||
//! [7]
|
||||
|
||||
//! [8]
|
||||
QMimeData *DragDropListModel::mimeData(const QModelIndexList &indexes) const
|
||||
{
|
||||
QMimeData *mimeData = new QMimeData();
|
||||
QByteArray encodedData;
|
||||
|
||||
QDataStream stream(&encodedData, QIODevice::WriteOnly);
|
||||
|
||||
foreach (const QModelIndex &index, indexes) {
|
||||
if (index.isValid()) {
|
||||
QString text = data(index, Qt::DisplayRole).toString();
|
||||
stream << text;
|
||||
}
|
||||
}
|
||||
|
||||
mimeData->setData("application/vnd.text.list", encodedData);
|
||||
return mimeData;
|
||||
}
|
||||
//! [8]
|
||||
|
||||
//! [9]
|
||||
QStringList DragDropListModel::mimeTypes() const
|
||||
{
|
||||
QStringList types;
|
||||
types << "application/vnd.text.list";
|
||||
return types;
|
||||
}
|
||||
//! [9]
|
||||
|
||||
//! [10]
|
||||
Qt::DropActions DragDropListModel::supportedDropActions() const
|
||||
{
|
||||
return Qt::CopyAction | Qt::MoveAction;
|
||||
}
|
||||
//! [10]
|
@ -38,50 +38,36 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of an example program for Qt.
|
||||
** EDITIONS: NOLIMITS
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
void wrapInFunction()
|
||||
#ifndef MODEL_H
|
||||
#define MODEL_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QStringListModel>
|
||||
|
||||
class DragDropListModel : public QStringListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
//! [0]
|
||||
QTransportAuth::Data *conData;
|
||||
QTransportAuth *a = QTransportAuth::getInstance();
|
||||
public:
|
||||
DragDropListModel(const QStringList &strings, QObject *parent = 0);
|
||||
|
||||
conData = a->connectTransport(
|
||||
QTransportAuth::Trusted | QTransportAuth::UnixStreamSock,
|
||||
socketDescriptor );
|
||||
//! [0]
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
|
||||
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
|
||||
int row, int column, const QModelIndex &parent);
|
||||
QMimeData *mimeData(const QModelIndexList &indexes) const;
|
||||
QStringList mimeTypes() const;
|
||||
Qt::DropActions supportedDropActions() const;
|
||||
};
|
||||
|
||||
//! [1]
|
||||
// mySocket can be any QIODevice subclass
|
||||
AuthDevice *ad = a->recvBuf( d, mySocket );
|
||||
|
||||
// proxy in the auth device where the socket would have gone
|
||||
connect( ad, SIGNAL(readyRead()), this, SLOT(mySocketReadyRead()));
|
||||
//! [1]
|
||||
|
||||
|
||||
//! [2]
|
||||
AuthDevice *ad = a->authBuf( d, mySocket );
|
||||
|
||||
ad->write( someData );
|
||||
//! [2]
|
||||
|
||||
|
||||
//! [3]
|
||||
policyCheck( QTransportAuth::Data &, const QString & )
|
||||
//! [3]
|
||||
|
||||
|
||||
//! [4]
|
||||
QTransportAuth::Result r = d.status & QTransportAuth::ErrMask;
|
||||
qWarning( "error: %s", QTransportAuth::errorStrings[r] );
|
||||
//! [4]
|
||||
|
||||
|
||||
//! [5]
|
||||
MD5(K XOR opad, MD5(K XOR ipad, text))
|
||||
//! [5]
|
||||
|
||||
}
|
||||
|
||||
#endif
|
5
src/widgets/doc/snippets/qlistview-dnd/qlistview-dnd.pro
Normal file
@ -0,0 +1,5 @@
|
||||
SOURCES = main.cpp \
|
||||
mainwindow.cpp \
|
||||
model.cpp
|
||||
HEADERS = mainwindow.h \
|
||||
model.h
|
@ -38,12 +38,14 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//! [0]
|
||||
configure -L <path to tslib library> -I <path to tslib headers>
|
||||
//! [0]
|
||||
#include <QtGui>
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
//! [1]
|
||||
module_raw input
|
||||
module linear
|
||||
//! [1]
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
MainWindow *window = new MainWindow;
|
||||
window->show();
|
||||
return app.exec();
|
||||
}
|
87
src/widgets/doc/snippets/qlistwidget-dnd/mainwindow.cpp
Normal file
@ -0,0 +1,87 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
MainWindow::MainWindow()
|
||||
{
|
||||
QMenu *fileMenu = new QMenu(tr("&File"));
|
||||
|
||||
QAction *quitAction = fileMenu->addAction(tr("E&xit"));
|
||||
quitAction->setShortcut(tr("Ctrl+Q"));
|
||||
|
||||
menuBar()->addMenu(fileMenu);
|
||||
|
||||
// For convenient quoting:
|
||||
//! [0]
|
||||
QListWidget *listWidget = new QListWidget(this);
|
||||
listWidget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
listWidget->setDragEnabled(true);
|
||||
listWidget->viewport()->setAcceptDrops(true);
|
||||
listWidget->setDropIndicatorShown(true);
|
||||
//! [0] //! [1]
|
||||
listWidget->setDragDropMode(QAbstractItemView::InternalMove);
|
||||
//! [1]
|
||||
|
||||
this->listWidget = listWidget;
|
||||
|
||||
connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
|
||||
|
||||
setupListItems();
|
||||
|
||||
setCentralWidget(listWidget);
|
||||
setWindowTitle(tr("List Widget"));
|
||||
}
|
||||
|
||||
void MainWindow::setupListItems()
|
||||
{
|
||||
QListWidgetItem *item;
|
||||
item = new QListWidgetItem(tr("Oak"), listWidget);
|
||||
item = new QListWidgetItem(tr("Fir"), listWidget);
|
||||
item = new QListWidgetItem(tr("Pine"), listWidget);
|
||||
item = new QListWidgetItem(tr("Birch"), listWidget);
|
||||
item = new QListWidgetItem(tr("Hazel"), listWidget);
|
||||
item = new QListWidgetItem(tr("Redwood"), listWidget);
|
||||
item = new QListWidgetItem(tr("Sycamore"), listWidget);
|
||||
item = new QListWidgetItem(tr("Chestnut"), listWidget);
|
||||
item = new QListWidgetItem(tr("Mahogany"), listWidget);
|
||||
}
|