Changeset 846 for trunk/doc/src/frameworks-technologies/gestures.qdoc
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/doc/src/frameworks-technologies/gestures.qdoc
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 7 7 ** This file is part of the documentation of the Qt Toolkit. 8 8 ** 9 ** $QT_BEGIN_LICENSE: LGPL$9 ** $QT_BEGIN_LICENSE:FDL$ 10 10 ** Commercial Usage 11 11 ** Licensees holding valid Qt Commercial licenses may use this file in 12 12 ** accordance with the Qt Commercial License Agreement provided with the 13 ** Software or, alternatively, in accordance with the terms contained in 14 ** a written agreement between you and Nokia. 15 ** 16 ** GNU Lesser General Public License Usage 17 ** Alternatively, this file may be used under the terms of the GNU Lesser 18 ** General Public License version 2.1 as published by the Free Software 19 ** Foundation and appearing in the file LICENSE.LGPL included in the 20 ** packaging of this file. Please review the following information to 21 ** ensure the GNU Lesser General Public License version 2.1 requirements 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 23 ** 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 ** 28 ** GNU General Public License Usage 29 ** Alternatively, this file may be used under the terms of the GNU 30 ** General Public License version 3.0 as published by the Free Software 31 ** Foundation and appearing in the file LICENSE.GPL included in the 32 ** packaging of this file. Please review the following information to 33 ** ensure the GNU General Public License version 3.0 requirements will be 34 ** met: http://www.gnu.org/copyleft/gpl.html. 13 ** Software or, alternatively, in accordance with the terms contained in a 14 ** written agreement between you and Nokia. 15 ** 16 ** GNU Free Documentation License 17 ** Alternatively, this file may be used under the terms of the GNU Free 18 ** Documentation License version 1.3 as published by the Free Software 19 ** Foundation and appearing in the file included in the packaging of this 20 ** file. 35 21 ** 36 22 ** If you have questions regarding the use of this file, please contact … … 43 29 \page gestures-overview.html 44 30 \title Gestures Programming 45 \ingroup frameworks-technologies46 31 \startpage index.html Qt Reference Documentation 47 48 \brief An overview of the Qt support for Gesture programming. 49 50 Qt includes a framework for gesture programming that gives has the ability 32 \ingroup technology-apis 33 \ingroup qt-gui-concepts 34 35 \brief An overview of Qt support for Gesture programming. 36 37 Qt includes a framework for gesture programming that has the ability 51 38 to form gestures from a series of events, independently of the input methods 52 39 used. A gesture could be a particular movement of a mouse, a touch screen … … 74 61 75 62 Gestures can be enabled for instances of QWidget and QGraphicsObject subclasses. 76 An object that accepts gesture input is referred to as a \e{target object}. 63 An object that accepts gesture input is referred to throughout the documentation 64 as a \e{target object}. 77 65 78 66 To enable a gesture for a target object, call its QWidget::grabGesture() or … … 83 71 \snippet examples/gestures/imagegestures/imagewidget.cpp enable gestures 84 72 85 In the above code, the gesture isset up in the constructor of the target object73 In the above code, the gestures are set up in the constructor of the target object 86 74 itself. 75 76 \section1 Handling Events 87 77 88 78 When the user performs a gesture, QGestureEvent events will be delivered to the 89 79 target object, and these can be handled by reimplementing the QWidget::event() 90 80 handler function for widgets or QGraphicsItem::sceneEvent() for graphics objects. 81 82 As one target object can subscribe to more than one gesture type, the QGestureEvent 83 can contain more than one QGesture, indicating several possible gestures are active 84 at the same time. It is then up to the widget to determine how to handle those 85 multiple gestures and choose if some should be canceled in favor of others. 86 87 Each QGesture contained within a QGestureEvent object can be accepted() or ignored() 88 individually, or all together. Additionally, you can query the individual QGesture 89 data objects (the state) using several getters. 90 91 \section2 Standard Procedure for Event Handling 92 93 A QGesture is by default accepted when it arrives at your widget. However, it is good 94 practice to always explicitly accept or reject a gesture. The general rule is that, if 95 you accept a gesture, you are using it. If you are ignoring it you are not interested 96 in it. Ignoring a gesture may mean it gets offered to another target object, or it will 97 get canceled. 98 99 Each QGesture has several states it goes through; there is a well defined way to change 100 the state, typically the user input is the cause of state changes (by starting and 101 stopping interaction, for instance) but the widget can also cause state changes. 102 103 The first time a particular QGesture is delivered to a widget or graphics item, it will 104 be in the Qt::GestureStarted state. The way you handle the gesture at this point 105 influences whether you can interact with it later. 106 107 \list 108 \o Accepting the gesture means the widget acts on the gesture and there will follow 109 gestures with the Qt::GestureUpdatedstate. 110 \o Ignoring the gesture will mean the gesture will never be offered to you again. 111 It will be offered to a parent widget or item as well. 112 \o Calling setGestureCancelPolicy() on the gesture when it is in its starting state, 113 and is also accepted can cause other gestures to be canceled. 114 \endlist 115 116 Using QGesture::CancelAllInContext to cancel a gesture will cause all gestures, in any 117 state, to be canceled unless they are explicitly accepted. This means that active 118 gestures on children will get canceled. It also means that gestures delivered in the 119 same QGestureEvent will get canceled if the widget ignores them. This can be a useful 120 way to filter out all gestures except the one you are interested in. 121 122 \section2 Example Event Handling 91 123 92 124 For convenience, the \l{Image Gestures Example} reimplements the general
Note:
See TracChangeset
for help on using the changeset viewer.