Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/doc/src/frameworks-technologies/gestures.qdoc

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    77** This file is part of the documentation of the Qt Toolkit.
    88**
    9 ** $QT_BEGIN_LICENSE:LGPL$
     9** $QT_BEGIN_LICENSE:FDL$
    1010** Commercial Usage
    1111** Licensees holding valid Qt Commercial licenses may use this file in
    1212** 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.
    3521**
    3622** If you have questions regarding the use of this file, please contact
     
    4329    \page gestures-overview.html
    4430    \title Gestures Programming
    45     \ingroup frameworks-technologies
    4631    \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
    5138    to form gestures from a series of events, independently of the input methods
    5239    used. A gesture could be a particular movement of a mouse, a touch screen
     
    7461
    7562    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}.
    7765
    7866    To enable a gesture for a target object, call its QWidget::grabGesture() or
     
    8371    \snippet examples/gestures/imagegestures/imagewidget.cpp enable gestures
    8472
    85     In the above code, the gesture is set up in the constructor of the target object
     73    In the above code, the gestures are set up in the constructor of the target object
    8674    itself.
     75
     76    \section1 Handling Events
    8777
    8878    When the user performs a gesture, QGestureEvent events will be delivered to the
    8979    target object, and these can be handled by reimplementing the QWidget::event()
    9080    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
    91123
    92124    For convenience, the \l{Image Gestures Example} reimplements the general
Note: See TracChangeset for help on using the changeset viewer.