Struct QGestureRecognizer

Source
#[repr(C)]
pub struct QGestureRecognizer { /* private fields */ }
Expand description

The QGestureRecognizer class provides the infrastructure for gesture recognition.

C++ class: QGestureRecognizer.

C++ documentation:

The QGestureRecognizer class provides the infrastructure for gesture recognition.

Gesture recognizers are responsible for creating and managing QGesture objects and monitoring input events sent to QWidget and QGraphicsObject subclasses. QGestureRecognizer is the base class for implementing custom gestures.

Developers that only need to provide gesture recognition for standard gestures do not need to use this class directly. Instances will be created behind the scenes by the framework.

For an overview of gesture handling in Qt and information on using gestures in your applications, see the Gestures in Widgets and Graphics View document.

Implementations§

Source§

impl QGestureRecognizer

Source

pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QGestureRecognizer>>, ) -> Ref<QGestureRecognizer>

The QGestureRecognizer class provides the infrastructure for gesture recognition.

Calls C++ function: QGestureRecognizer& QGestureRecognizer::operator=(const QGestureRecognizer& other).

C++ documentation:

The QGestureRecognizer class provides the infrastructure for gesture recognition.

Gesture recognizers are responsible for creating and managing QGesture objects and monitoring input events sent to QWidget and QGraphicsObject subclasses. QGestureRecognizer is the base class for implementing custom gestures.

Developers that only need to provide gesture recognition for standard gestures do not need to use this class directly. Instances will be created behind the scenes by the framework.

For an overview of gesture handling in Qt and information on using gestures in your applications, see the Gestures in Widgets and Graphics View document.

Source

pub unsafe fn create( &self, target: impl CastInto<Ptr<QObject>>, ) -> QPtr<QGesture>

This function is called by Qt to create a new QGesture object for the given target (QWidget or QGraphicsObject).

Calls C++ function: virtual QGesture* QGestureRecognizer::create(QObject* target).

C++ documentation:

This function is called by Qt to create a new QGesture object for the given target (QWidget or QGraphicsObject).

Reimplement this function to create a custom QGesture-derived gesture object if necessary.

The application takes ownership of the created gesture object.

Source

pub unsafe fn recognize( &self, state: impl CastInto<Ptr<QGesture>>, watched: impl CastInto<Ptr<QObject>>, event: impl CastInto<Ptr<QEvent>>, ) -> QFlags<ResultFlag>

Handles the given event for the watched object, updating the state of the gesture object as required, and returns a suitable result for the current recognition step.

Calls C++ function: pure virtual QFlags<QGestureRecognizer::ResultFlag> QGestureRecognizer::recognize(QGesture* state, QObject* watched, QEvent* event).

C++ documentation:

Handles the given event for the watched object, updating the state of the gesture object as required, and returns a suitable result for the current recognition step.

This function is called by the framework to allow the recognizer to filter input events dispatched to QWidget or QGraphicsObject instances that it is monitoring.

The result reflects how much of the gesture has been recognized. The state of the gesture object is set depending on the result.

See also QGestureRecognizer::Result.

Source

pub unsafe fn register_recognizer( recognizer: impl CastInto<Ptr<QGestureRecognizer>>, ) -> GestureType

Registers the given recognizer in the gesture framework and returns a gesture ID for it.

Calls C++ function: static Qt::GestureType QGestureRecognizer::registerRecognizer(QGestureRecognizer* recognizer).

C++ documentation:

Registers the given recognizer in the gesture framework and returns a gesture ID for it.

The application takes ownership of the recognizer and returns the gesture type ID associated with it. For gesture recognizers which handle custom QGesture objects (i.e., those which return Qt::CustomGesture in a QGesture::gestureType() function) the return value is a generated gesture ID with the Qt::CustomGesture flag set.

See also unregisterRecognizer(), QGestureRecognizer::create(), and QGesture.

Source

pub unsafe fn reset(&self, state: impl CastInto<Ptr<QGesture>>)

This function is called by the framework to reset a given gesture.

Calls C++ function: virtual void QGestureRecognizer::reset(QGesture* state).

C++ documentation:

This function is called by the framework to reset a given gesture.

Reimplement this function to implement additional requirements for custom QGesture objects. This may be necessary if you implement a custom QGesture whose properties need special handling when the gesture is reset.

Source

pub unsafe fn unregister_recognizer(type_: GestureType)

Unregisters all gesture recognizers of the specified type.

Calls C++ function: static void QGestureRecognizer::unregisterRecognizer(Qt::GestureType type).

C++ documentation:

Unregisters all gesture recognizers of the specified type.

See also registerRecognizer().

Trait Implementations§

Source§

impl CppDeletable for QGestureRecognizer

Source§

unsafe fn delete(&self)

Destroys the gesture recognizer.

Calls C++ function: virtual [destructor] void QGestureRecognizer::~QGestureRecognizer().

C++ documentation:

Destroys the gesture recognizer.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

Source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> StaticUpcast<T> for T

Source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.