Doc: Added documentation for the examples

- Moved documentation for the Qt XML, Qt Widgets, Qt Concurrent, and
Qt Network examples from qtdoc.
- Grouped the documentation pages under relevant groups
- Fixed \snippet paths

Task-number: QTBUG-27515
Change-Id: I43c22a679e2eefbb48e3cd5893aa2afd3d905863
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
Venugopal Shivashankar 2012-12-06 19:27:20 +01:00 committed by The Qt Project
parent 5b3e7c8dfa
commit 6a9eb8ed01
51 changed files with 552 additions and 60 deletions

View File

@ -29,9 +29,7 @@
\example blockingfortuneclient \example blockingfortuneclient
\title Blocking Fortune Client Example \title Blocking Fortune Client Example
\ingroup examples-network \ingroup examples-network
\brief Demonstrates how to create a client for a network service
\brief The Blocking Fortune Client example shows how to create a client for a
network service using QTcpSocket's synchronous API in a non-GUI thread.
\image blockingfortuneclient-example.png \image blockingfortuneclient-example.png

View File

@ -29,9 +29,10 @@
\example broadcastreceiver \example broadcastreceiver
\title Broadcast Receiver Example \title Broadcast Receiver Example
\ingroup examples-network \ingroup examples-network
\brief Demonstrates how to receive information broadcasted over a local network.
\brief The Broadcast Receiver example shows how to receive information that is broadcasted This example uses the Qt Network APIs to demonstrate how to receive
over a local network. messages broadcasted over a local network.
\image broadcastreceiver-example.png \image broadcastreceiver-example.png
*/ */

View File

@ -29,9 +29,10 @@
\example broadcastsender \example broadcastsender
\title Broadcast Sender Example \title Broadcast Sender Example
\ingroup examples-network \ingroup examples-network
\brief Demonstrates how to broadcast information to multiple clients on a local network.
\brief The Broadcast Sender example shows how to broadcast information to multiple clients This example uses Qt Network APIs to demonstrate how to broadcast messages
on a local network. to multiple clients over a local network.
\image broadcastsender-example.png \image broadcastsender-example.png
*/ */

View File

@ -29,9 +29,9 @@
\example fortuneclient \example fortuneclient
\title Fortune Client Example \title Fortune Client Example
\ingroup examples-network \ingroup examples-network
\brief Demonstrates how to create a client for a network service
\brief The Fortune Client example shows how to create a client for a simple This example uses QTcpSocket, and is intended to be run alongside the
network service using QTcpSocket. It is intended to be run alongside the
\l{fortuneserver}{Fortune Server} example or \l{fortuneserver}{Fortune Server} example or
the \l{threadedfortuneserver}{Threaded Fortune Server} example. the \l{threadedfortuneserver}{Threaded Fortune Server} example.

View File

@ -29,15 +29,15 @@
\example fortuneserver \example fortuneserver
\title Fortune Server Example \title Fortune Server Example
\ingroup examples-network \ingroup examples-network
\brief Demonstrates how to create a server for a network service.
\brief The Fortune Server example shows how to create a server for a simple This example is intended to be run alongside the
network service. It is intended to be run alongside the
\l{fortuneclient}{Fortune Client} example or the \l{fortuneclient}{Fortune Client} example or the
\l{blockingfortuneclient}{Blocking Fortune Client} example. \l{blockingfortuneclient}{Blocking Fortune Client} example.
\image fortuneserver-example.png Screenshot of the Fortune Server example \image fortuneserver-example.png Screenshot of the Fortune Server example
This example uses QTcpServer to accept incoming TCP connections, and a It uses QTcpServer to accept incoming TCP connections, and a
simple QDataStream based data transfer protocol to write a fortune to the simple QDataStream based data transfer protocol to write a fortune to the
connecting client (from the \l{fortuneclient}{Fortune Client} connecting client (from the \l{fortuneclient}{Fortune Client}
example), before closing the connection. example), before closing the connection.

View File

@ -29,10 +29,10 @@
\example googlesuggest \example googlesuggest
\title Google Suggest Example \title Google Suggest Example
\ingroup examples-network \ingroup examples-network
\brief Obtains the list of search recommendations by the Google search engine
\brief The Google Suggest example demonstrates how to use the QNetworkAccessManager The example uses the QNetworkAccessManager to obtain the list of search
class to obtain a list of suggestions from the Google search engine as the recommendations by Google as the user types into a QLineEdit.
user types into a QLineEdit.
\image googlesuggest-example.png \image googlesuggest-example.png

View File

@ -29,9 +29,10 @@
\example http \example http
\title HTTP Example \title HTTP Example
\ingroup examples-network \ingroup examples-network
\brief Demonstrates a simple HTTP client
\brief The HTTP example demonstrates a simple HTTP client that shows how to fetch files This example demonstrates how a simple HTTP client can fetch files
specified by URLs from remote hosts. from remote hosts.
\image http-example.png \image http-example.png
*/ */

View File

@ -29,9 +29,10 @@
\example loopback \example loopback
\title Loopback Example \title Loopback Example
\ingroup examples-network \ingroup examples-network
\brief Demonstrates the client-server communication on a local host
\brief The Loopback example shows how to communicate between simple clients and servers on a local The example demonstrates how the clients and servers on a local host
host. communicate with each other.
\image loopback-example.png \image loopback-example.png
*/ */

View File

@ -29,9 +29,8 @@
\example multicastreceiver \example multicastreceiver
\title Multicast Receiver Example \title Multicast Receiver Example
\ingroup examples-network \ingroup examples-network
\brief Demonstrates how to receive information sent to a multicast group
\brief The Multicast Receiever example shows how to receive information that is This example demonstrates how to receive messages sent to a multicast group
sent to a multicast group.
\image multicastreceiver-example.png \image multicastreceiver-example.png
*/ */

View File

@ -29,9 +29,10 @@
\example multicastsender \example multicastsender
\title Multicast Sender Example \title Multicast Sender Example
\ingroup examples-network \ingroup examples-network
\brief Demonstrates how to send messages to a multicast group
\brief The Multicast Sender example shows how to send information to multiple This example demonstrates how to send messages to the clients of a
clients in a multicast group. multicast group.
\image multicastsender-example.png \image multicastsender-example.png
*/ */

View File

@ -29,10 +29,10 @@
\example network-chat \example network-chat
\title Network Chat Example \title Network Chat Example
\ingroup examples-network \ingroup examples-network
\brief Demonstrates a stateful peer-to-peer Chat client
\brief The Network Chat example demonstrates a stateful peer-to-peer Chat client This example uses broadcasting with QUdpSocket and QNetworkInterface to
that uses broadcasting with QUdpSocket and QNetworkInterface to discover discover its peers.
its peers.
\image network-chat-example.png \image network-chat-example.png
*/ */

View File

@ -0,0 +1,41 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\example network/download
\title Network Download Example
\brief Demonstrates how to use networking APIs for multiple downloads
\ingroup examples-network
The Network Download example shows how to perform multiple downloads in
parallel using the QNetworkAccessManager class.
This example is designed to be run from the command-line.
The \l{Network Download Manager Example} implements a more complex system
that places files in a queue for sequential downloading.
*/

View File

@ -0,0 +1,41 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\example network/downloadmanager
\title Network Download Manager Example
\brief Demonstrates how to use the networking APIs for multiple downloads
\ingroup examples-network
The Network Download example shows how to implement a queue for multiple
downloads using the QNetworkAccessManager class.
This example is designed to be run from the command-line.
See the \l{Network Download Example} for a simpler version of this example
that obtains multiple files in parallel.
*/

View File

@ -29,11 +29,11 @@
\example securesocketclient \example securesocketclient
\title Secure Socket Client Example \title Secure Socket Client Example
\ingroup examples-network \ingroup examples-network
\brief Demonstrates how to communicate over an encrypted (SSL) connection
\brief The Secure Socket Client example shows how to use QSslSocket to This example uses QSslSocket to demonstrate how to communicate over an
communicate over an encrypted (SSL) connection. It also demonstrates how encrypted connection, deal with authenticity problems, and display security
to deal with authenticity problems, and how to display security and and certificate information.
certificate information.
\image securesocketclient.png \image securesocketclient.png
\image securesocketclient2.png \image securesocketclient2.png

View File

@ -29,9 +29,10 @@
\example torrent \example torrent
\title Torrent Example \title Torrent Example
\ingroup examples-network \ingroup examples-network
\brief Demonstrates complex TCP/IP operations
\brief The Torrent example is a functional BitTorrent client that This example demonstrates some of the complex TCP/IP operations
illustrates how to write a complex TCP/IP application using Qt. supported by the Qt Network APIs.
\image torrent-example.png \image torrent-example.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -0,0 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\example qtconcurrent/imagescaling
\title Image Scaling Example
\bried Demonstrates how to asynchronously scale images.
\ingroup qtconcurrentexamples
The QtConcurrent Map example shows how to use the asynchronous
QtConcurrent API to load and scale a collection of images.
\image imagescaling_example.png
*/

View File

@ -0,0 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\example qtconcurrent/map
\title Map Example
\brief Demonstrates how to scale images synchronously.
\ingroup qtconcurrentexamples
The QtConcurrent Map example shows how to use the synchronous (blocking)
QtConcurrent API to scale a collection of images.
This is a command-line application.
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -0,0 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\example qtconcurrent/progressdialog
\title QtConcurrent Progress Dialog Example
\brief Demonstrates how to monitor the progress of the active processes.
\ingroup qtconcurrentexamples
The QtConcurrent Progress Dialog example shows how to use the
QFutureWatcher class to monitor the progress of a long-running operation.
\image qtconcurrent-progressdialog.png
*/

View File

@ -0,0 +1,39 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\example qtconcurrent/runfunction
\title Run Function Example
\brief Demonstrates how to run standard functions concurrently.
\ingroup qtconcurrentexamples
The QtConcurrent Run Function example shows how to apply concurrency to
a standard function, using QFuture instances to retrieve return values
at a later time.
This is a command-line application.
*/

View File

@ -0,0 +1,39 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\example qtconcurrent/wordcount
\title QtConcurrent Word Count Example
\brief Demonstrates how to use the map-reduce algorithm
\ingroup qtconcurrentexamples
The QtConcurrent Word Count example demonstrates the use of the map-reduce
algorithm when applied to the problem of counting words in a collection
of files.
This is a command-line application.
*/

View File

@ -28,6 +28,8 @@
/*! /*!
\example mandelbrot \example mandelbrot
\title Mandelbrot Example \title Mandelbrot Example
\brief Demonstrates multi-thread programming using Qt
\ingroup qtconcurrent-mtexamples
\brief The Mandelbrot example shows how to use a worker thread to \brief The Mandelbrot example shows how to use a worker thread to
perform heavy computations without blocking the main thread's perform heavy computations without blocking the main thread's

View File

@ -28,6 +28,8 @@
/*! /*!
\example queuedcustomtype \example queuedcustomtype
\title Queued Custom Type Example \title Queued Custom Type Example
\brief Demonstrates multi-thread programming using Qt
\ingroup qtconcurrent-mtexamples
\brief The Queued Custom Type example shows how to send custom types between \brief The Queued Custom Type example shows how to send custom types between
threads with queued signals and slots. threads with queued signals and slots.

View File

@ -28,6 +28,8 @@
/*! /*!
\example semaphores \example semaphores
\title Semaphores Example \title Semaphores Example
\brief Demonstrates multi-thread programming using Qt
\ingroup qtconcurrent-mtexamples
\brief The Semaphores example shows how to use QSemaphore to control \brief The Semaphores example shows how to use QSemaphore to control
access to a circular buffer shared by a producer thread and a access to a circular buffer shared by a producer thread and a

View File

@ -28,6 +28,8 @@
/*! /*!
\example waitconditions \example waitconditions
\title Wait Conditions Example \title Wait Conditions Example
\brief Demonstrates multi-thread programming using Qt
\ingroup qtconcurrent-mtexamples
\brief The Wait Conditions example shows how to use QWaitCondition and \brief The Wait Conditions example shows how to use QWaitCondition and
QMutex to control access to a circular buffer shared by a QMutex to control access to a circular buffer shared by a

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

View File

@ -29,9 +29,9 @@
\example graphicsview/basicgraphicslayouts \example graphicsview/basicgraphicslayouts
\title Basic Graphics Layouts Example \title Basic Graphics Layouts Example
\ingroup examples-graphicsview-layout \ingroup examples-graphicsview-layout
\brief This example shows how to use some basic layouts. \brief Demonstrates how to create basic graphics layout
\brief The Basic Graphics Layouts example shows how to use the layout classes The Basic Graphics Layouts example shows how to use the layout classes
in QGraphicsView: QGraphicsLinearLayout and QGraphicsGridLayout. in QGraphicsView: QGraphicsLinearLayout and QGraphicsGridLayout.
In addition to that it shows how to write your own custom layout item. In addition to that it shows how to write your own custom layout item.

View File

@ -29,7 +29,7 @@
\example effects/blurpicker \example effects/blurpicker
\title Blur Picker Effect Example \title Blur Picker Effect Example
\ingroup examples-graphicsview-graphicseffects \ingroup examples-graphicsview-graphicseffects
\brief This example shows the use of QGraphicsBlurEffect. \brief Demonstrates how to apply graphical effects on items in the view
\image blurpickereffect-example.png \image blurpickereffect-example.png
*/ */

View File

@ -29,8 +29,7 @@
\example graphicsview/boxes \example graphicsview/boxes
\title Boxes \title Boxes
\ingroup examples-graphicsview \ingroup examples-graphicsview
\brief This demo shows Qt's ability to combine advanced OpenGL rendering with the \brief Combines advanced OpenGL rendering with the Graphics View framework
the \l{Graphics View Framework}.
\image boxes-demo.png \image boxes-demo.png

View File

@ -29,10 +29,9 @@
\example graphicsview/chip \example graphicsview/chip
\title 40000 Chips \title 40000 Chips
\ingroup examples-graphicsview \ingroup examples-graphicsview
\brief This demo shows how to visualize a huge scene with 40000 chip items \brief Visualizes a huge graphic view scene with 40000 chip items
using Graphics View.
It also shows Graphics View's powerful navigation This examples demonstrates Graphics View's powerful navigation
and interaction features, allowing you to zoom and rotate each of four and interaction features, allowing you to zoom and rotate each of four
views independently, and you can select and move items around the scene. views independently, and you can select and move items around the scene.

View File

@ -28,6 +28,8 @@
/*! /*!
\example graphicsview/collidingmice \example graphicsview/collidingmice
\title Colliding Mice Example \title Colliding Mice Example
\brief Demonstrates how to animate items on a graphics view
\ingroup examples-graphicsview
The Colliding Mice example shows how to use the Graphics View The Colliding Mice example shows how to use the Graphics View
framework to implement animated items and detect collision between framework to implement animated items and detect collision between

View File

@ -29,7 +29,7 @@
\example graphicsview/diagramscene \example graphicsview/diagramscene
\title Diagram Scene Example \title Diagram Scene Example
\ingroup examples-graphicsview \ingroup examples-graphicsview
\brief This example shows use of Qt's graphics framework. \brief Demonstrate how to use the Graphics View framework
\image diagramscene.png \image diagramscene.png

View File

@ -29,7 +29,9 @@
\example graphicsview/dragdroprobot \example graphicsview/dragdroprobot
\title Drag and Drop Robot Example \title Drag and Drop Robot Example
\ingroup examples-graphicsview \ingroup examples-graphicsview
\brief The Drag and Drop Robot example shows how to implement Drag and Drop in a \brief Demonstrates how to drag and drop items in a graphics view
The Drag and Drop Robot example shows how to implement Drag and Drop in a
QGraphicsItem subclass, as well as how to animate items using Qt's QGraphicsItem subclass, as well as how to animate items using Qt's
\l{Animation Framework}. \l{Animation Framework}.

View File

@ -29,10 +29,10 @@
\example graphicsview/elasticnodes \example graphicsview/elasticnodes
\title Elastic Nodes Example \title Elastic Nodes Example
\ingroup examples-graphicsview \ingroup examples-graphicsview
\brief The Elastic Nodes example shows how to implement edges between nodes in a \brief Demonstrates how to interact with graphical items in a scene
graph, with basic interaction.
You can click to drag a node around, and The Elastic Nodes example shows how to implement edges between nodes in a
graph, with basic interaction. You can click to drag a node around, and
zoom in and out using the mouse wheel or the keyboard. Hitting the space zoom in and out using the mouse wheel or the keyboard. Hitting the space
bar will randomize the nodes. The example is also resolution independent; bar will randomize the nodes. The example is also resolution independent;
as you zoom in, the graphics remain crisp. as you zoom in, the graphics remain crisp.

View File

@ -29,10 +29,10 @@
\example graphicsview/embeddeddialogs \example graphicsview/embeddeddialogs
\title Embedded Dialogs \title Embedded Dialogs
\ingroup examples-graphicsview-layout \ingroup examples-graphicsview-layout
\brief This example shows how to embed standard dialogs into \brief Demonstrates how to embed dialogs into a graphics view
Graphics View.
It also shows how you can customize the This example shows how to embed standard dialogs into
Graphics View. It also shows how you can customize the
proxy class and add window shadows. proxy class and add window shadows.
\image embeddeddialogs-demo.png \image embeddeddialogs-demo.png

View File

@ -29,9 +29,9 @@
\example effects/fademessage \example effects/fademessage
\title Fade Message Effect Example \title Fade Message Effect Example
\ingroup examples-graphicsview-graphicseffects \ingroup examples-graphicsview-graphicseffects
\brief This example shows the use of QGraphicsColorizeEffect. \brief Demonstrates how to appliy effects on items in the view
\div { style="text-align: center"} \div { style="text-align: left"}
\inlineimage fademessageeffect-example.png \inlineimage fademessageeffect-example.png
\inlineimage fademessageeffect-example-faded.png \inlineimage fademessageeffect-example-faded.png
\enddiv \enddiv

View File

@ -29,8 +29,10 @@
\example graphicsview/anchorlayout \example graphicsview/anchorlayout
\title Anchor Layout Example \title Anchor Layout Example
\ingroup examples-graphicsview-layout \ingroup examples-graphicsview-layout
\brief This example shows how to use QGraphicsAnchorLayout. \brief Demonstrates anchor layout in a graphics view scene
The Anchor Layout example demonstrates the use of the QGraphicsAnchorLayout The Anchor Layout example demonstrates the use of the QGraphicsAnchorLayout
class. class.
\image graphicsanchorlayout-example.png
*/ */

View File

@ -29,10 +29,12 @@
\example graphicsview/flowlayout \example graphicsview/flowlayout
\title Graphics View Flow Layout Example \title Graphics View Flow Layout Example
\ingroup examples-graphicsview-layout \ingroup examples-graphicsview-layout
\brief This example shows how to make a flow layout in Graphics View. \brief Demonstrates flow layout on a graphics view scene.
The Graphics View Flow Layout example shows the use of a flow layout The Graphics View Flow Layout example shows the use of a flow layout
in a Graphics View widget. in a Graphics View widget.
\image graphicsflowlayout-example.png
See the \l{Flow Layout Example} for a corresponding widget-based example. See the \l{Flow Layout Example} for a corresponding widget-based example.
*/ */

View File

@ -29,8 +29,10 @@
\example graphicsview/simpleanchorlayout \example graphicsview/simpleanchorlayout
\title Simple Anchor Layout Example \title Simple Anchor Layout Example
\ingroup examples-graphicsview-layout \ingroup examples-graphicsview-layout
\brief This example shows how basic use of QGraphicsAnchorLayout. \brief Demonstrates anchor layout on a graphics view scene
The Simple Anchor Layout example shows the basic use of the The Simple Anchor Layout example shows the basic use of the
QGraphicsAnchorLayout class. QGraphicsAnchorLayout class.
\image graphicssimpleanchorlayout-example.png
*/ */

View File

@ -29,8 +29,10 @@
\example graphicsview/weatheranchorlayout \example graphicsview/weatheranchorlayout
\title Weather Anchor Layout Example \title Weather Anchor Layout Example
\ingroup examples-graphicsview-layout \ingroup examples-graphicsview-layout
\brief This example shows advanced use of QGraphicsAnchorLayout. \brief Demonstrates anchor layout on a graphics view scene
The Weather Anchor Layout example shows more complex use of the The Weather Anchor Layout example shows more complex use of the
QGraphicsAnchorLayout class to create a real-world window layout. QGraphicsAnchorLayout class to create a real-world window layout.
\image weatheranchorlayout-example.png
*/ */

View File

@ -29,7 +29,7 @@
\example effects/lighting \example effects/lighting
\title Lighting Effect Example \title Lighting Effect Example
\ingroup examples-graphicsview-graphicseffects \ingroup examples-graphicsview-graphicseffects
\brief This example shows the use of QGraphicsDropShadowEffect. \brief Demonstrates how to apply effects on items in the view
\image lightingeffect-example.png \image lightingeffect-example.png
*/ */

View File

@ -29,7 +29,9 @@
\example graphicsview/padnavigator \example graphicsview/padnavigator
\title Pad Navigator Example \title Pad Navigator Example
\ingroup examples-graphicsview \ingroup examples-graphicsview
\brief The Pad Navigator Example shows how you can use Graphics View together with \brief Demonstrates how to create animated user interface
The Pad Navigator Example shows how you can use Graphics View together with
embedded widgets and Qt's \l{State Machine Framework} to create a simple embedded widgets and Qt's \l{State Machine Framework} to create a simple
but useful, dynamic, animated user interface. but useful, dynamic, animated user interface.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -0,0 +1,194 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\example xml/streambookmarks
\title QXmlStream Bookmarks Example
\brief Demonstrates how to read and write to XBEL files
\ingroup xml-examples
The QXmlStream Bookmarks example provides a reader for XML Bookmark
Exchange Language (XBEL) files using Qt's QXmlStreamReader class
for reading, and QXmlStreamWriter class for writing the files.
\image xmlstreamexample-screenshot.png
\section1 XbelWriter Class Definition
The \c XbelWriter class contains a private instance of QXmlStreamWriter,
which provides an XML writer with a streaming API. \c XbelWriter also
has a reference to the QTreeWidget instance where the bookmark hierarchy
is stored.
\snippet streambookmarks/xbelwriter.h 0
\section1 XbelWriter Class Implementation
The \c XbelWriter constructor accepts a \a treeWidget to initialize within
its definition. We enable \l{QXmlStreamWriter}'s auto-formatting property
to ensure line-breaks and indentations are added automatically to empty
sections between elements, increasing readability as the data is split into
several lines.
\snippet streambookmarks/xbelwriter.cpp 0
The \c writeFile() function accepts a QIODevice object and sets it using
\c setDevice(). This function then writes the document type
definition(DTD), the start element, the version, and \c{treeWidget}'s
top-level items.
\snippet streambookmarks/xbelwriter.cpp 1
The \c writeItem() function accepts a QTreeWidgetItem object and writes it
to the stream, depending on its \c tagName, which can either be a "folder",
"bookmark", or "separator".
\snippet streambookmarks/xbelwriter.cpp 2
\section1 XbelReader Class Definition
The \c XbelReader contains a private instance of QXmlStreamReader, the
companion class to QXmlStreamWriter. \c XbelReader also contains a
reference to the QTreeWidget that is used to group the bookmarks according
to their hierarchy.
\snippet streambookmarks/xbelreader.h 0
\section1 XbelReader Class Implementation
The \c XbelReader constructor accepts a QTreeWidget to initialize the
\c treeWidget within its definition. A QStyle object is used to set
\c{treeWidget}'s style property. The \c folderIcon is set to QIcon::Normal
mode where the pixmap is only displayed when the user is not interacting
with the icon. The QStyle::SP_DirClosedIcon, QStyle::SP_DirOpenIcon, and
QStyle::SP_FileIcon correspond to standard pixmaps that follow the style
of your GUI.
\snippet streambookmarks/xbelreader.cpp 0
The \c read() function accepts a QIODevice and sets it using
\l{QXmlStreamReader::}{setDevice()}. The actual process of reading only
takes place if the file is a valid XBEL 1.0 file. Note that the XML input
needs to be well-formed to be accepted by QXmlStreamReader. Otherwise, the
\l{QXmlStreamReader::}{raiseError()} function is used to display an error
message. Since the XBEL reader is only concerned with reading XML elements,
it makes extensive use of the \l{QXmlStreamReader::}{readNextStartElement()}
convenience function.
\snippet streambookmarks/xbelreader.cpp 1
The \c errorString() function is used if an error occurred, in order to
obtain a description of the error complete with line and column number
information.
\snippet streambookmarks/xbelreader.cpp 2
The \c readXBEL() function reads the name of a startElement and calls
the appropriate function to read it, depending on whether if its a
"folder", "bookmark" or "separator". Otherwise, it calls
\l{QXmlStreamReader::}{skipCurrentElement()}. The Q_ASSERT() macro is used
to provide a pre-condition for the function.
\snippet streambookmarks/xbelreader.cpp 3
The \c readTitle() function reads the bookmark's title.
\snippet streambookmarks/xbelreader.cpp 4
The \c readSeparator() function creates a separator and sets its flags.
The text is set to 30 "0xB7", the HEX equivalent for period. The element
is then skipped using \l{QXmlStreamReader::}{skipCurrentElement()}.
\snippet streambookmarks/xbelreader.cpp 5
\section1 MainWindow Class Definition
The \c MainWindow class is a subclass of QMainWindow, with a
\c File menu and a \c Help menu.
\snippet streambookmarks/mainwindow.h 0
\section1 MainWindow Class Implementation
The \c MainWindow constructor instantiates the QTreeWidget object, \c
treeWidget and sets its header with a QStringList object, \c labels.
The constructor also invokes \c createActions() and \c createMenus()
to set up the menus and their corresponding actions. The \c statusBar()
is used to display the message "Ready" and the window's size is fixed
to 480x320 pixels.
\snippet streambookmarks/mainwindow.cpp 0
The \c open() function enables the user to open an XBEL file using
QFileDialog::getOpenFileName(). A warning message is displayed along
with the \c fileName and \c errorString if the file cannot be read or
if there is a parse error.
\snippet streambookmarks/mainwindow.cpp 1
The \c saveAs() function displays a QFileDialog, prompting the user for
a \c fileName using QFileDialog::getSaveFileName(). Similar to the
\c open() function, this function also displays a warning message if
the file cannot be written to.
\snippet streambookmarks/mainwindow.cpp 2
The \c about() function displays a QMessageBox with a brief description
of the example.
\snippet streambookmarks/mainwindow.cpp 3
In order to implement the \c open(), \c saveAs(), \c exit(), \c about()
and \c aboutQt() functions, we connect them to QAction objects and
add them to the \c fileMenu and \c helpMenu. The connections are as shown
below:
\snippet streambookmarks/mainwindow.cpp 4
The \c createMenus() function creates the \c fileMenu and \c helpMenu
and adds the QAction objects to them in order to create the menu shown
in the screenshot below:
\table
\row
\li \inlineimage xmlstreamexample-filemenu.png
\li \inlineimage xmlstreamexample-helpmenu.png
\endtable
\snippet streambookmarks/mainwindow.cpp 5
\section1 \c{main()} Function
The \c main() function instantiates \c MainWindow and invokes the \c show()
function.
\snippet streambookmarks/main.cpp 0
See the \l{http://pyxml.sourceforge.net/topics/xbel/}
{XML Bookmark Exchange Language Resource Page} for more information
about XBEL files.
*/

View File

@ -28,9 +28,10 @@
/*! /*!
\example saxbookmarks \example saxbookmarks
\title SAX Bookmarks Example \title SAX Bookmarks Example
\brief Demonstrates how to read XBEL files
\ingroup xml-examples
\brief The SAX Bookmarks example provides a reader for XML Bookmark Exchange Language (XBEL) This example uses Qt's SAX API to read and parse the files. The DOM Bookmarks
files that uses Qt's SAX-based API to read and parse the files. The DOM Bookmarks
example provides an alternative way to read this type of file. example provides an alternative way to read this type of file.
\image saxbookmarks-example.png \image saxbookmarks-example.png