IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

PointerEvent QML Type

Provides information about an event from a pointing device.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

PointerEvent QML Type

  • Import Statement: import QtQuick 2.12

  • Group: PointerEvent is part of qtquick-input-events

Detailed Description

A PointerEvent is an event describing contact or movement across a surface, provided by a mouse, a touchpoint (single finger on a touchscreen), or a stylus on a graphics tablet. The device property provides more information about where the event came from.

Image non disponible

See Also

See also PointerHandler

Property Documentation

 

[read-only] button : enumeration

This property holds the button that caused the event, if any. If the device does not have buttons, or the event is a hover event, it will be Qt.NoButton.

[read-only] buttons : int

This property holds the combination of mouse or stylus buttons pressed when the event was generated. For move events, this is all buttons that are pressed down. For press events, this includes the button that caused the event, as well as any others that were already held. For release events, this excludes the button that caused the event.

[read-only] device : PointerDevice

This property holds the device that generated the event.

[read-only] modifiers : int

This property holds the keyboard modifier flags that existed immediately before the event occurred.

It contains a bitwise combination of the following flags:

Constant

Description

Qt.NoModifier

No modifier key is pressed.

Qt.ShiftModifier

A Shift key on the keyboard is pressed.

Qt.ControlModifier

A Ctrl key on the keyboard is pressed.

Qt.AltModifier

An Alt key on the keyboard is pressed.

Qt.MetaModifier

A Meta key on the keyboard is pressed.

Qt.KeypadModifier

A keypad button is pressed.

For example, to react to a Shift key + Left mouse button click:

 
Sélectionnez
Item {
    TapHandler {
        onTapped: {
            if ((event.button == Qt.LeftButton) && (event.modifiers & Qt.ShiftModifier))
                doSomething();
        }
    }
}

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+