CopperSpice API  1.9.2
QGesture Class Reference

The QGesture class represents a gesture, containing properties that describe the corresponding user input. More...

Inheritance diagram for QGesture:
QObject QPanGesture QPinchGesture QSwipeGesture QTapAndHoldGesture QTapGesture

Public Types

enum  GestureCancelPolicy
 

Public Methods

 QGesture (QObject *parent=nullptr)
 
 ~QGesture ()
 
GestureCancelPolicy gestureCancelPolicy () const
 
Qt::GestureType gestureType () const
 
bool hasHotSpot () const
 
QPointF hotSpot () const
 
void setGestureCancelPolicy (GestureCancelPolicy policy)
 
void setHotSpot (const QPointF &value)
 
Qt::GestureState state () const
 
void unsetHotSpot ()
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 

Properties

 gestureCancelPolicy
 
 gestureType
 
 hasHotSpot
 
 hotSpot
 
 state
 
- Properties inherited from QObject
 objectName
 

Friends

class QGestureEvent
 
class QGestureRecognizer
 

Additional Inherited Members

- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 
- Public Slots inherited from QObject
void deleteLater ()
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

The QGesture class represents a gesture, containing properties that describe the corresponding user input. Gesture objects are not constructed directly by developers. They are created by the QGestureRecognizer object that is registered with the application; see QGestureRecognizer::registerRecognizer().

For an overview of gesture handling in CopperSpice and information on using gestures in your applications, refer to Gestures Programming.

Gesture Properties

The class has a list of properties that can be queried by the user to get some gesture-specific arguments. For example, the pinch gesture has a scale factor that is exposed as a property.

Developers of custom gesture recognizers can add additional properties in order to provide additional information about a gesture. This can be done by adding new dynamic properties to a QGesture object, or by subclassing the QGesture class (or one of its subclasses).

Lifecycle of a Gesture Object

A QGesture instance is implicitly created when needed and is owned by CopperSpice. Developers should never destroy them or store them for later use as CopperSpice may destroy particular instances of them and create new ones to replace them.

The registered gesture recognizer monitors the input events for the target object via its recognize() function, updating the properties of the gesture object as required.

The gesture object may be delivered to the target object in a QGestureEvent if the corresponding gesture is active or has just been canceled. Each event that is delivered contains a list of gesture objects, since support for more than one gesture may be enabled for the target object. Due to the way events are handled in CopperSpice, gesture events may be filtered by other objects.

See also
QGestureEvent, QGestureRecognizer

Member Enumeration Documentation

This enum describes how accepting a gesture can cancel other gestures automatically.

ConstantValueDescription
QGesture::CancelNone0 On accepting this gesture no other gestures will be affected.
QGesture::CancelAllInContext1 On accepting this gesture all gestures that are active in the context (respecting the Qt::GestureFlag that were specified when subscribed to the gesture) will be canceled.

Constructor & Destructor Documentation

QGesture::QGesture ( QObject parent = nullptr)
explicit

Constructs a new gesture object with the given parent.

QGesture objects are created by gesture recognizers in the QGestureRecognizer::create() function.

QGesture::~QGesture ( )

Destroys the gesture object.

Method Documentation

GestureCancelPolicy QGesture::gestureCancelPolicy ( ) const

Returns the value of the property.

Qt::GestureType QGesture::gestureType ( ) const

Returns the value of the property.

bool QGesture::hasHotSpot ( ) const

Returns the value of the property.

QPointF QGesture::hotSpot ( ) const

Returns the value of the property.

void QGesture::setGestureCancelPolicy ( GestureCancelPolicy  policy)

Sets the value of the property to policy.

void QGesture::setHotSpot ( const QPointF value)

Sets the value of the property to value.

Qt::GestureState QGesture::state ( ) const

Returns the value of the property.

void QGesture::unsetHotSpot ( )

Resets the value of the property.

Property Documentation

QGesture::gestureCancelPolicy

This property holds the policy for deciding what happens on accepting a gesture.

On accepting one gesture CopperSpice can automatically cancel other gestures that belong to other targets. The policy is normally set to not cancel any other gestures and can be set to cancel all active gestures in the context. For example for all child widgets.

PropertiesClass Methods
read gestureCancelPolicy
write setGestureCancelPolicy
QGesture::gestureType

This property holds the type of the gesture.

PropertiesClass Methods
read gestureType
QGesture::hasHotSpot

This property holds whether the gesture has a hot-spot.

PropertiesClass Methods
read hasHotSpot
QGesture::hotSpot

This property holds the point that is used to find the receiver for the gesture event.

The hot-spot is a point in the global coordinate system, use QWidget::mapFromGlobal() or QGestureEvent::mapToGraphicsScene() to get a local hot-spot.

The hot-spot should be set by the gesture recognizer to allow gesture event delivery to a QGraphicsObject.

PropertiesClass Methods
read hotSpot
write setHotSpot
reset unsetHotSpot
QGesture::state

This property holds the current state of the gesture.

PropertiesClass Methods
read state