summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorNico Vertriest <nico.vertriest@digia.com>2013-12-12 10:22:34 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-23 17:00:30 +0100
commit4fab72a5eb19d34eb9b96a192fd901ddf7db2c92 (patch)
tree0024ae909ecad290005080a50cdc24234c54c60a /examples
parentd0b1bf3996bb1fb20e9592b7e8f1ce6d7ed0c659 (diff)
Doc: corrected broken links
Links fixed: Extra Filters Basic Tools blockingfortuneclient Thread Support Drag and drop examples qBinaryFind qmake common project types imagegestures Task-number: QTBUG-34749 Change-Id: Ib93dda00716dc596db327fee5b97e110a9f27fa7 Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/gestures/imagegestures/doc/src/imagegestures.qdoc100
-rw-r--r--examples/widgets/doc/src/plugandpaint.qdoc20
2 files changed, 110 insertions, 10 deletions
diff --git a/examples/gestures/imagegestures/doc/src/imagegestures.qdoc b/examples/gestures/imagegestures/doc/src/imagegestures.qdoc
new file mode 100644
index 0000000000..cb76ee83b1
--- /dev/null
+++ b/examples/gestures/imagegestures/doc/src/imagegestures.qdoc
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 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 gestures/imagegestures
+ \title Image Gestures Example
+
+ This example shows how to enable gestures for a widget and use gesture input
+ to perform actions.
+
+ We use two classes to create the user interface for the application: \c MainWidget
+ and \c ImageWidget. The \c MainWidget class is simply used as a container for the
+ \c ImageWidget class, which we will configure to accept gesture input. Since we
+ are interested in the way gestures are used, we will concentrate on the
+ implementation of the \c ImageWidget class.
+
+ \section1 ImageWidget Class Definition
+
+ The \c ImageWidget class is a simple QWidget subclass that reimplements the general
+ QWidget::event() handler function in addition to several more specific event handlers:
+
+ \snippet examples/gestures/imagegestures/imagewidget.h class definition begin
+ \dots
+ \snippet examples/gestures/imagegestures/imagewidget.h class definition end
+
+ We also implement a private helper function, \c gestureEvent(), to help manage
+ gesture events delivered to the widget, and three functions to perform actions
+ based on gestures: \c panTriggered(), \c pinchTriggered() and \c swipeTriggered().
+
+ \section1 ImageWidget Class Implementation
+
+ In the widget's constructor, we begin by setting up various parameters that will
+ be used to control the way images are displayed.
+
+ \snippet examples/gestures/imagegestures/imagewidget.cpp constructor
+
+ We enable three of the standard gestures for the widget by calling QWidget::grabGesture()
+ with the types of gesture we need. These will be recognized by the application's
+ default gesture recognizer, and events will be delivered to our widget.
+
+ Since QWidget does not define a specific event handler for gestures, the widget
+ needs to reimplement the general QWidget::event() to receive gesture events.
+
+ \snippet examples/gestures/imagegestures/imagewidget.cpp event handler
+
+ We implement the event handler to delegate gesture events to a private function
+ specifically written for the task, and pass all other events to QWidget's
+ implementation.
+
+ The \c gestureHandler() function examines the gestures supplied by the
+ newly-delivered QGestureEvent. Since only one gesture of a given type can be
+ used on a widget at any particular time, we can check for each gesture type
+ using the QGestureEvent::gesture() function:
+
+ \snippet examples/gestures/imagegestures/imagewidget.cpp gesture event handler
+
+ If a QGesture object is supplied for a certain type of gesture, we call a special
+ purpose function to deal with it, casting the gesture object to the appropriate
+ QGesture subclass.
+
+ To illustrate how a standard gesture can be interpreted by an application, we
+ show the implementation of the \c swipeTriggered() function, which handles the
+ gesture associated with a brushing or swiping motion on the user's display or
+ input device:
+
+ \snippet examples/gestures/imagegestures/imagewidget.cpp swipe function
+
+ The QSwipeGesture class provides specialized functions and defines a enum
+ to make it more convenient for developers to discover which direction, if
+ any, the user swiped the display. Here, we simply navigate to the previous
+ image in the collection if the user swiped upwards or to the left; otherwise
+ we navigate to the next image in the collection.
+
+ The other gestures are also handled by special purpose functions, but use
+ the values of properties held by the QGesture object passed to them.
+*/
diff --git a/examples/widgets/doc/src/plugandpaint.qdoc b/examples/widgets/doc/src/plugandpaint.qdoc
index bfb763b7d1..5098d892ef 100644
--- a/examples/widgets/doc/src/plugandpaint.qdoc
+++ b/examples/widgets/doc/src/plugandpaint.qdoc
@@ -47,9 +47,9 @@
If you want to learn how to make your own application extensible
through plugins, we recommend that you start by reading this
overview, which explains how to make an application use plugins.
- Afterward, you can read the
+ Afterwards, you can read the
\l{tools/plugandpaintplugins/basictools}{Basic Tools} and
- \l{plugandpaintplugins/extrafilters}{Extra Filters}
+ \l{tools/plugandpaintplugins/extrafilters}{Extra Filters}
overviews, which show how to implement static and dynamic
plugins, respectively.
@@ -126,8 +126,8 @@
a good idea to include a version number in the string, as we did
above.
- The \l{plugandpaintplugins/basictools}{Basic Tools} plugin
- and the \l{plugandpaintplugins/extrafilters}{Extra Filters}
+ The \l{tools/plugandpaintplugins/basictools}{Basic Tools} plugin
+ and the \l{tools/plugandpaintplugins/extrafilters}{Extra Filters}
plugin shows how to derive from \c BrushInterface, \c
ShapeInterface, and \c FilterInterface.
@@ -275,7 +275,7 @@
\section1 Importing Static Plugins
- The \l{plugandpaintplugins/basictools}{Basic Tools} plugin
+ The \l{tools/plugandpaintplugins/basictools}{Basic Tools} plugin
is built as a static plugin, to ensure that it is always
available to the application. This requires using the
Q_IMPORT_PLUGIN() macro somewhere in the application (in a \c
@@ -307,7 +307,7 @@
This completes our review of the Plug & Paint application. At
this point, you might want to take a look at the
- \l{plugandpaintplugins/basictools}{Basic Tools} example
+ \l{tools/plugandpaintplugins/basictools}{Basic Tools} example
plugin.
*/
@@ -473,7 +473,7 @@
To make the plugin a static plugin, all that is required is to
specify \c static in addition to \c plugin. The
- \l{plugandpaintplugins/extrafilters}{Extra Filters} plugin,
+ \l{tools/plugandpaintplugins/extrafilters}{Extra Filters} plugin,
which is compiled as a dynamic plugin, doesn't specify \c static
in its \c .pro file.
@@ -503,13 +503,13 @@
The Extra Filters example is a plugin for the
\l{plugandpaint}{Plug & Paint} example. It provides a set
of filters in addition to those provided by the
- \l{plugandpaintplugins/basictools}{Basic Tools} plugin.
+ \l{tools/plugandpaintplugins/basictools}{Basic Tools} plugin.
Since the approach is identical to
- \l{plugandpaintplugins/basictools}{Basic Tools}, we won't
+ \l{tools/plugandpaintplugins/basictools}{Basic Tools}, we won't
review the code here. The only part of interest is the
\c .pro file, since Extra Filters is a dynamic plugin
- (\l{plugandpaintplugins/basictools}{Basic Tools} is
+ (\l{tools/plugandpaintplugins/basictools}{Basic Tools} is
linked statically into the Plug & Paint executable).
Here's the project file for building the Extra Filters plugin: