Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
#include <qquickmousearea_p.h>
Public Member Functions | |
QQuickMouseArea (QQuickItem *parent=nullptr) | |
\qmltype MouseArea \nativetype QQuickMouseArea \inqmlmodule QtQuick | |
~QQuickMouseArea () | |
qreal | mouseX () const |
\qmlproperty real QtQuick::MouseArea::mouseX \qmlproperty real QtQuick::MouseArea::mouseY These properties hold the coordinates of the mouse cursor. | |
qreal | mouseY () const |
bool | isEnabled () const |
\qmlproperty bool QtQuick::MouseArea::enabled This property holds whether the item accepts mouse events. | |
void | setEnabled (bool) |
bool | isScrollGestureEnabled () const |
\qmlproperty bool QtQuick::MouseArea::scrollGestureEnabled | |
void | setScrollGestureEnabled (bool) |
bool | hovered () const |
\qmlproperty bool QtQuick::MouseArea::containsMouse This property holds whether the mouse is currently inside the mouse area. | |
bool | isPressed () const |
\qmlproperty bool QtQuick::MouseArea::pressed This property holds whether any of the \l acceptedButtons are currently pressed. | |
bool | containsPress () const |
\qmlproperty bool QtQuick::MouseArea::containsPress | |
Qt::MouseButtons | pressedButtons () const |
\qmlproperty MouseButtons QtQuick::MouseArea::pressedButtons This property holds the mouse buttons currently pressed. | |
Qt::MouseButtons | acceptedButtons () const |
\qmlproperty Qt::MouseButtons QtQuick::MouseArea::acceptedButtons This property holds the mouse buttons that the mouse area reacts to. | |
void | setAcceptedButtons (Qt::MouseButtons buttons) |
bool | hoverEnabled () const |
\qmlproperty bool QtQuick::MouseArea::hoverEnabled This property holds whether hover events are handled. | |
void | setHoverEnabled (bool h) |
bool | preventStealing () const |
\qmlproperty bool QtQuick::MouseArea::preventStealing This property holds whether the mouse events may be stolen from this MouseArea. | |
void | setPreventStealing (bool prevent) |
bool | propagateComposedEvents () const |
\qmlproperty bool QtQuick::MouseArea::propagateComposedEvents This property holds whether composed mouse events will automatically propagate to other MouseAreas that overlap with this MouseArea but are lower in the visual stacking order. | |
void | setPropagateComposedEvents (bool propagate) |
int | pressAndHoldInterval () const |
\qmlproperty Qt::CursorShape QtQuick::MouseArea::cursorShape This property holds the cursor shape for this mouse area. | |
void | setPressAndHoldInterval (int interval) |
void | resetPressAndHoldInterval () |
Public Member Functions inherited from QQuickItem | |
QQuickItem (QQuickItem *parent=nullptr) | |
Constructs a QQuickItem with the given parent. | |
~QQuickItem () override | |
Destroys the QQuickItem. | |
QQuickWindow * | window () const |
Returns the window in which this item is rendered. | |
QQuickItem * | parentItem () const |
void | setParentItem (QQuickItem *parent) |
void | stackBefore (const QQuickItem *) |
Moves the specified sibling item to the index before this item within the list of children. | |
void | stackAfter (const QQuickItem *) |
Moves the specified sibling item to the index after this item within the list of children. | |
QRectF | childrenRect () |
\qmlpropertygroup QtQuick::Item::childrenRect \qmlproperty real QtQuick::Item::childrenRect.x \qmlproperty real QtQuick::Item::childrenRect.y \qmlproperty real QtQuick::Item::childrenRect.width \qmlproperty real QtQuick::Item::childrenRect.height \readonly | |
QList< QQuickItem * > | childItems () const |
Returns the children of this item. | |
bool | clip () const |
\qmlproperty bool QtQuick::Item::clip This property holds whether clipping is enabled. | |
void | setClip (bool) |
QString | state () const |
\qmlproperty string QtQuick::Item::state | |
void | setState (const QString &) |
qreal | baselineOffset () const |
\qmlproperty int QtQuick::Item::baselineOffset | |
void | setBaselineOffset (qreal) |
QQmlListProperty< QQuickTransform > | transform () |
qreal | x () const |
qreal | y () const |
QPointF | position () const |
void | setX (qreal) |
void | setY (qreal) |
void | setPosition (const QPointF &) |
QBindable< qreal > | bindableX () |
QBindable< qreal > | bindableY () |
qreal | width () const |
void | setWidth (qreal) |
void | resetWidth () |
void | setImplicitWidth (qreal) |
qreal | implicitWidth () const |
Returns the width of the item that is implied by other properties that determine the content. | |
QBindable< qreal > | bindableWidth () |
qreal | height () const |
void | setHeight (qreal) |
void | resetHeight () |
void | setImplicitHeight (qreal) |
qreal | implicitHeight () const |
QBindable< qreal > | bindableHeight () |
QSizeF | size () const |
void | setSize (const QSizeF &size) |
TransformOrigin | transformOrigin () const |
void | setTransformOrigin (TransformOrigin) |
QPointF | transformOriginPoint () const |
void | setTransformOriginPoint (const QPointF &) |
qreal | z () const |
void | setZ (qreal) |
qreal | rotation () const |
void | setRotation (qreal) |
qreal | scale () const |
void | setScale (qreal) |
qreal | opacity () const |
void | setOpacity (qreal) |
bool | isVisible () const |
void | setVisible (bool) |
bool | isEnabled () const |
void | setEnabled (bool) |
bool | smooth () const |
void | setSmooth (bool) |
bool | activeFocusOnTab () const |
\qmlproperty bool QtQuick::Item::activeFocusOnTab | |
void | setActiveFocusOnTab (bool) |
bool | antialiasing () const |
void | setAntialiasing (bool) |
void | resetAntialiasing () |
Flags | flags () const |
Returns the item flags for this item. | |
void | setFlag (Flag flag, bool enabled=true) |
Enables the specified flag for this item if enabled is true; if enabled is false, the flag is disabled. | |
void | setFlags (Flags flags) |
Enables the specified flags for this item. | |
virtual QRectF | boundingRect () const |
Returns the extents of the item in its own coordinate system: a rectangle from {0, 0} to \l width() and \l height(). | |
virtual QRectF | clipRect () const |
Returns the rectangular area within this item that is currently visible in \l viewportItem(), if there is a viewport and the \l ItemObservesViewport flag is set; otherwise, the extents of this item in its own coordinate system: a rectangle from {0, 0} to \l width() and \l height(). | |
QQuickItem * | viewportItem () const |
If the \l ItemObservesViewport flag is set, returns the nearest parent with the \l ItemIsViewport flag. | |
bool | hasActiveFocus () const |
bool | hasFocus () const |
void | setFocus (bool) |
void | setFocus (bool focus, Qt::FocusReason reason) |
bool | isFocusScope () const |
Returns true if this item is a focus scope, and false otherwise. | |
QQuickItem * | scopedFocusItem () const |
If this item is a focus scope, this returns the item in its focus chain that currently has focus. | |
Qt::FocusPolicy | focusPolicy () const |
void | setFocusPolicy (Qt::FocusPolicy policy) |
Sets the focus policy of this item to policy. | |
bool | isAncestorOf (const QQuickItem *child) const |
Returns true if this item is an ancestor of child (i.e., if this item is child's parent, or one of child's parent's ancestors). | |
Qt::MouseButtons | acceptedMouseButtons () const |
Returns the mouse buttons accepted by this item. | |
void | setAcceptedMouseButtons (Qt::MouseButtons buttons) |
Sets the mouse buttons accepted by this item to buttons. | |
bool | acceptHoverEvents () const |
Returns whether hover events are accepted by this item. | |
void | setAcceptHoverEvents (bool enabled) |
If enabled is true, this sets the item to accept hover events; otherwise, hover events are not accepted by this item. | |
bool | acceptTouchEvents () const |
Returns whether touch events are accepted by this item. | |
void | setAcceptTouchEvents (bool accept) |
If enabled is true, this sets the item to accept touch events; otherwise, touch events are not accepted by this item. | |
bool | isUnderMouse () const |
void | grabMouse () |
void | ungrabMouse () |
bool | keepMouseGrab () const |
Returns whether mouse input should exclusively remain with this item. | |
void | setKeepMouseGrab (bool) |
Sets whether the mouse input should remain exclusively with this item. | |
bool | filtersChildMouseEvents () const |
Returns whether pointer events intended for this item's children should be filtered through this item. | |
void | setFiltersChildMouseEvents (bool filter) |
Sets whether pointer events intended for this item's children should be filtered through this item. | |
void | grabTouchPoints (const QList< int > &ids) |
void | ungrabTouchPoints () |
bool | keepTouchGrab () const |
Returns whether the touch points grabbed by this item should exclusively remain with this item. | |
void | setKeepTouchGrab (bool) |
Sets whether the touch points grabbed by this item should remain exclusively with this item. | |
Q_REVISION (2, 4) Q_INVOKABLE bool grabToImage(const QJSValue &callback | |
QSharedPointer< QQuickItemGrabResult > | grabToImage (const QSize &targetSize=QSize()) |
Grabs the item into an in-memory image. | |
virtual Q_INVOKABLE bool | contains (const QPointF &point) const |
\qmlmethod bool QtQuick::Item::contains(point point) | |
QObject * | containmentMask () const |
void | setContainmentMask (QObject *mask) |
QTransform | itemTransform (QQuickItem *, bool *) const |
\qmlmethod point QtQuick::Item::mapFromItem(Item item, real x, real y) \qmlmethod point QtQuick::Item::mapFromItem(Item item, point p) \qmlmethod rect QtQuick::Item::mapFromItem(Item item, real x, real y, real width, real height) \qmlmethod rect QtQuick::Item::mapFromItem(Item item, rect r) | |
QPointF | mapToScene (const QPointF &point) const |
Maps the given point in this item's coordinate system to the equivalent point within the scene's coordinate system, and returns the mapped coordinate. | |
QRectF | mapRectToItem (const QQuickItem *item, const QRectF &rect) const |
Maps the given rect in this item's coordinate system to the equivalent rectangular area within item's coordinate system, and returns the mapped rectangle value. | |
QRectF | mapRectToScene (const QRectF &rect) const |
Maps the given rect in this item's coordinate system to the equivalent rectangular area within the scene's coordinate system, and returns the mapped rectangle value. | |
QPointF | mapFromScene (const QPointF &point) const |
Maps the given point in the scene's coordinate system to the equivalent point within this item's coordinate system, and returns the mapped coordinate. | |
QRectF | mapRectFromItem (const QQuickItem *item, const QRectF &rect) const |
Maps the given rect in item's coordinate system to the equivalent rectangular area within this item's coordinate system, and returns the mapped rectangle value. | |
QRectF | mapRectFromScene (const QRectF &rect) const |
Maps the given rect in the scene's coordinate system to the equivalent rectangular area within this item's coordinate system, and returns the mapped rectangle value. | |
void | polish () |
Schedules a polish event for this item. | |
Q_INVOKABLE QPointF | mapFromItem (const QQuickItem *item, const QPointF &point) const |
Maps the given point in item's coordinate system to the equivalent point within this item's coordinate system, and returns the mapped coordinate. | |
Q_INVOKABLE QPointF | mapFromItem (const QQuickItem *item, qreal x, qreal y) |
Q_INVOKABLE QRectF | mapFromItem (const QQuickItem *item, const QRectF &rect) const |
Q_INVOKABLE QRectF | mapFromItem (const QQuickItem *item, qreal x, qreal y, qreal width, qreal height) const |
Q_INVOKABLE QPointF | mapToItem (const QQuickItem *item, const QPointF &point) const |
Maps the given point in this item's coordinate system to the equivalent point within item's coordinate system, and returns the mapped coordinate. | |
Q_INVOKABLE QPointF | mapToItem (const QQuickItem *item, qreal x, qreal y) |
Q_INVOKABLE QRectF | mapToItem (const QQuickItem *item, const QRectF &rect) const |
Q_INVOKABLE QRectF | mapToItem (const QQuickItem *item, qreal x, qreal y, qreal width, qreal height) const |
Q_REVISION (2, 7) Q_INVOKABLE QPointF mapFromGlobal(qreal x | |
Q_REVISION (2, 7) Q_INVOKABLE QPointF mapFromGlobal(const QPointF &point) const | |
Q_REVISION (2, 7) Q_INVOKABLE QPointF mapToGlobal(qreal x | |
Q_REVISION (2, 7) Q_INVOKABLE QPointF mapToGlobal(const QPointF &point) const | |
Q_INVOKABLE void | forceActiveFocus () |
\qmlmethod point QtQuick::Item::mapToItem(Item item, real x, real y) \qmlmethod point QtQuick::Item::mapToItem(Item item, point p) \qmlmethod rect QtQuick::Item::mapToItem(Item item, real x, real y, real width, real height) \qmlmethod rect QtQuick::Item::mapToItem(Item item, rect r) | |
Q_INVOKABLE void | forceActiveFocus (Qt::FocusReason reason) |
\qmlmethod QtQuick::Item::forceActiveFocus(Qt::FocusReason reason) This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Forces active focus on the item with the given reason. | |
Q_REVISION (2, 1) Q_INVOKABLE QQuickItem *nextItemInFocusChain(bool forward | |
Q_INVOKABLE QQuickItem * | childAt (qreal x, qreal y) const |
\qmlmethod QtQuick::Item::childAt(real x, real y) | |
Q_REVISION (6, 3) Q_INVOKABLE void ensurePolished() | |
Q_REVISION (6, 3) Q_INVOKABLE void dumpItemTree() const | |
virtual bool | isTextureProvider () const |
Returns true if this item is a texture provider. | |
virtual QSGTextureProvider * | textureProvider () const |
Returns the texture provider for an item. | |
Public Member Functions inherited from QObject | |
Q_INVOKABLE | QObject (QObject *parent=nullptr) |
Constructs an object with parent object parent. | |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. | |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
Filters events if this object has been installed as an event filter for the watched object. | |
QString | objectName () const |
Q_WEAK_OVERLOAD void | setObjectName (const QString &name) |
Sets the object's name to name. | |
void | setObjectName (QAnyStringView name) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QBindable< QString > | bindableObjectName () |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false . | |
bool | isWindowType () const |
Returns true if the object is a window; otherwise returns false . | |
bool | isQuickItemType () const |
Returns true if the object is a QQuickItem; otherwise returns false . | |
bool | signalsBlocked () const noexcept |
Returns true if signals are blocked; otherwise returns false . | |
bool | blockSignals (bool b) noexcept |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). | |
QThread * | thread () const |
Returns the thread in which the object lives. | |
bool | moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL) |
Changes the thread affinity for this object and its children and returns true on success. | |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds. | |
int | startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer) |
void | killTimer (int id) |
Kills the timer with timer identifier, id. | |
void | killTimer (Qt::TimerId id) |
template<typename T > | |
T | findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object. | |
template<typename T > | |
QList< T > | findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. | |
template<typename T > | |
T | findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<typename T > | |
QList< T > | findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const QObjectList & | children () const |
Returns a list of child objects. | |
void | setParent (QObject *parent) |
Makes the object a child of parent. | |
void | installEventFilter (QObject *filterObj) |
Installs an event filter filterObj on this object. | |
void | removeEventFilter (QObject *obj) |
Removes an event filter object obj from this object. | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const |
bool | disconnect (const QObject *receiver, const char *member=nullptr) const |
void | dumpObjectTree () const |
Dumps a tree of children to the debug output. | |
void | dumpObjectInfo () const |
Dumps information about signal connections, etc. | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. | |
bool | setProperty (const char *name, QVariant &&value) |
QVariant | property (const char *name) const |
Returns the value of the object's name property. | |
QList< QByteArray > | dynamicPropertyNames () const |
QBindingStorage * | bindingStorage () |
const QBindingStorage * | bindingStorage () const |
QObject * | parent () const |
Returns a pointer to the parent object. | |
bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false . | |
Public Member Functions inherited from QQmlParserStatus | |
QQmlParserStatus () | |
virtual | ~QQmlParserStatus () |
Protected Member Functions | |
void | setHovered (bool) |
bool | setPressed (Qt::MouseButton button, bool p, Qt::MouseEventSource source) |
bool | sendMouseEvent (QMouseEvent *event) |
void | mousePressEvent (QMouseEvent *event) override |
This event handler can be reimplemented in a subclass to receive mouse press events for an item. | |
void | mouseReleaseEvent (QMouseEvent *event) override |
This event handler can be reimplemented in a subclass to receive mouse release events for an item. | |
void | mouseDoubleClickEvent (QMouseEvent *event) override |
This event handler can be reimplemented in a subclass to receive mouse double-click events for an item. | |
void | mouseMoveEvent (QMouseEvent *event) override |
This event handler can be reimplemented in a subclass to receive mouse move events for an item. | |
void | mouseUngrabEvent () override |
This event handler can be reimplemented in a subclass to be notified when a mouse ungrab event has occurred on this item. | |
void | touchUngrabEvent () override |
This event handler can be reimplemented in a subclass to be notified when a touch ungrab event has occurred on this item. | |
void | hoverEnterEvent (QHoverEvent *event) override |
This event handler can be reimplemented in a subclass to receive hover-enter events for an item. | |
void | hoverMoveEvent (QHoverEvent *event) override |
This event handler can be reimplemented in a subclass to receive hover-move events for an item. | |
void | hoverLeaveEvent (QHoverEvent *event) override |
This event handler can be reimplemented in a subclass to receive hover-leave events for an item. | |
bool | childMouseEventFilter (QQuickItem *i, QEvent *e) override |
Reimplement this method to filter the pointer events that are received by this item's children. | |
void | timerEvent (QTimerEvent *event) override |
This event handler can be reimplemented in a subclass to receive timer events for the object. | |
void | geometryChange (const QRectF &newGeometry, const QRectF &oldGeometry) override |
void | itemChange (ItemChange change, const ItemChangeData &value) override |
Called when change occurs for this item. | |
QSGNode * | updatePaintNode (QSGNode *, UpdatePaintNodeData *) override |
\qmlpropertygroup QtQuick::MouseArea::drag \qmlproperty Item QtQuick::MouseArea::drag.target \qmlproperty bool QtQuick::MouseArea::drag.active \qmlproperty enumeration QtQuick::MouseArea::drag.axis \qmlproperty real QtQuick::MouseArea::drag.minimumX \qmlproperty real QtQuick::MouseArea::drag.maximumX \qmlproperty real QtQuick::MouseArea::drag.minimumY \qmlproperty real QtQuick::MouseArea::drag.maximumY \qmlproperty bool QtQuick::MouseArea::drag.filterChildren \qmlproperty real QtQuick::MouseArea::drag.threshold \qmlproperty bool QtQuick::MouseArea::drag.smoothed | |
Protected Member Functions inherited from QQuickItem | |
bool | event (QEvent *) override |
\reimp | |
bool | isComponentComplete () const |
Returns true if construction of the QML component is complete; otherwise returns false. | |
bool | widthValid () const |
Returns whether the width property has been set explicitly. | |
bool | heightValid () const |
Returns whether the height property has been set explicitly. | |
void | setImplicitSize (qreal, qreal) |
void | classBegin () override |
\reimp Derived classes should call the base class method before adding their own action to perform at classBegin. | |
void | componentComplete () override |
\reimp Derived classes should call the base class method before adding their own actions to perform at componentComplete. | |
virtual void | keyPressEvent (QKeyEvent *event) |
This event handler can be reimplemented in a subclass to receive key press events for an item. | |
virtual void | keyReleaseEvent (QKeyEvent *event) |
This event handler can be reimplemented in a subclass to receive key release events for an item. | |
virtual void | focusInEvent (QFocusEvent *) |
This event handler can be reimplemented in a subclass to receive focus-in events for an item. | |
virtual void | focusOutEvent (QFocusEvent *) |
This event handler can be reimplemented in a subclass to receive focus-out events for an item. | |
virtual void | touchEvent (QTouchEvent *event) |
This event handler can be reimplemented in a subclass to receive touch events for an item. | |
virtual void | releaseResources () |
This function is called when an item should release graphics resources which are not already managed by the nodes returned from QQuickItem::updatePaintNode(). | |
virtual void | updatePolish () |
This function should perform any layout as required for this item. | |
QQuickItem (QQuickItemPrivate &dd, QQuickItem *parent=nullptr) | |
Protected Member Functions inherited from QObject | |
QObject * | sender () const |
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr. | |
int | senderSignalIndex () const |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. | |
bool | isSignalConnected (const QMetaMethod &signal) const |
virtual void | childEvent (QChildEvent *event) |
This event handler can be reimplemented in a subclass to receive child events. | |
virtual void | customEvent (QEvent *event) |
This event handler can be reimplemented in a subclass to receive custom events. | |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
QObject (QObjectPrivate &dd, QObject *parent=nullptr) | |
Properties | |
qreal | mouseX |
qreal | mouseY |
bool | containsMouse |
bool | pressed |
bool | enabled |
bool | scrollGestureEnabled |
Qt::MouseButtons | pressedButtons |
Qt::MouseButtons | acceptedButtons |
bool | hoverEnabled |
bool | preventStealing |
bool | propagateComposedEvents |
bool | containsPress |
int | pressAndHoldInterval |
Properties inherited from QQuickItem | |
QQuickItem * | parent |
\qmlproperty Item QtQuick::Item::parent This property holds the visual parent of the item. | |
qreal | x |
\qmlproperty real QtQuick::Item::x \qmlproperty real QtQuick::Item::y \qmlproperty real QtQuick::Item::width \qmlproperty real QtQuick::Item::height | |
qreal | y |
Defines the item's y position relative to its parent. | |
qreal | z |
\qmlproperty real QtQuick::Item::z | |
qreal | width |
This property holds the width of this item. | |
qreal | height |
This property holds the height of this item. | |
qreal | opacity |
\qmlproperty real QtQuick::Item::opacity | |
bool | enabled |
\qmlproperty bool QtQuick::Item::enabled | |
bool | visible |
\qmlproperty bool QtQuick::Item::visible | |
Qt::FocusPolicy | focusPolicy |
\qmlproperty enumeration QtQuick::Item::focusPolicy | |
qreal | rotation |
\qmlproperty real QtQuick::Item::rotation This property holds the rotation of the item in degrees clockwise around its transformOrigin. | |
qreal | scale |
\qmlproperty real QtQuick::Item::scale This property holds the scale factor for this item. | |
TransformOrigin | transformOrigin |
\qmlproperty enumeration QtQuick::Item::transformOrigin This property holds the origin point around which scale and rotation transform. | |
QPointF | transformOriginPoint |
QQmlListProperty< QQuickTransform > | transform |
\qmlproperty list<Transform> QtQuick::Item::transform This property holds the list of transformations to apply. | |
bool | smooth |
\qmlproperty bool QtQuick::Item::smooth | |
bool | antialiasing |
\qmlproperty bool QtQuick::Item::antialiasing | |
qreal | implicitWidth |
qreal | implicitHeight |
QObject * | containmentMask |
\qmlproperty QObject* QtQuick::Item::containmentMask | |
Properties inherited from QObject | |
QString | objectName |
the name of this object | |
Additional Inherited Members | |
Public Types inherited from QQuickItem | |
enum | Flag { ItemClipsChildrenToShape = 0x01 , ItemIsFocusScope = 0x04 , ItemHasContents = 0x08 , ItemAcceptsDrops = 0x10 , ItemIsViewport = 0x20 , ItemObservesViewport = 0x40 } |
\qmltype Item \nativetype QQuickItem \inherits QtObject \inqmlmodule QtQuick More... | |
enum | ItemChange { ItemChildAddedChange , ItemChildRemovedChange , ItemSceneChange , ItemVisibleHasChanged , ItemParentHasChanged , ItemOpacityHasChanged , ItemActiveFocusHasChanged , ItemRotationHasChanged , ItemAntialiasingHasChanged , ItemDevicePixelRatioHasChanged , ItemEnabledHasChanged , ItemScaleHasChanged , ItemTransformHasChanged } |
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes. More... | |
enum | TransformOrigin { TopLeft , Top , TopRight , Left , Center , Right , BottomLeft , Bottom , BottomRight } |
\variable QQuickItem::ItemChangeData::realValue The numeric value that has changed: \l {QQuickItem::opacity()}{opacity}, \l {QQuickItem::rotation()}{rotation}, or \l {QQuickItem::scale()}{scale}, or \l {QScreen::devicePixelRatio}{device pixel ratio}. More... | |
Public Slots inherited from QQuickItem | |
void | update () |
Schedules a call to updatePaintNode() for this item. | |
Public Slots inherited from QObject | |
void | deleteLater () |
\threadsafe | |
Static Public Member Functions inherited from QObject | |
static QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
\threadsafe | |
static QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
\threadsafe | |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static bool | disconnect (const QMetaObject::Connection &) |
Disconnect a connection. | |
template<typename Func1 , typename Func2 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot) |
template<typename Func1 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero) |
Public Attributes inherited from QQuickItem | |
const QSize & | targetSize = QSize()) |
qreal y | const |
Protected Attributes inherited from QObject | |
QScopedPointer< QObjectData > | d_ptr |
Related Symbols inherited from QObject | |
template< class T > T | qobject_cast (const QObject *object) |
Returns the given object cast to type T if the object is of type T (or of a subclass); otherwise returns \nullptr. | |
template< typename T > T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
template< typename T > QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QObjectList | |
\macro Q_CLASSINFO(Name, Value) | |
Definition at line 29 of file qquickmousearea_p.h.
QQuickMouseArea::QQuickMouseArea | ( | QQuickItem * | parent = nullptr | ) |
\qmltype MouseArea \nativetype QQuickMouseArea \inqmlmodule QtQuick
Enables simple mouse handling. \inherits Item
A MouseArea is an invisible item that is typically used in conjunction with a visible item in order to provide mouse handling for that item. By effectively acting as a proxy, the logic for mouse handling can be contained within a MouseArea item.
The \l enabled property is used to enable and disable mouse handling for the proxied item. When disabled, the mouse area becomes transparent to mouse events.
MouseArea is an invisible Item, but it has a visible property. When set to false, the mouse area becomes transparent to mouse events.
The \l pressed read-only property indicates whether or not the user is holding down a mouse button over the mouse area. This property is often used in bindings between properties in a user interface. The containsMouse read-only property indicates the presence of the mouse cursor over the mouse area but, by default, only when a mouse button is held down; see the containsMouse documentation for details.
Information about the mouse position and button clicks are provided via signals for which event handler properties are defined. The most commonly used involved handling mouse presses and clicks: onClicked, onDoubleClicked, onPressed, onReleased and onPressAndHold. It's also possible to handle mouse wheel events via the onWheel signal.
If a MouseArea overlaps with the area of other MouseArea items, you can choose to propagate clicked
, doubleClicked
and pressAndHold
events to these other items by setting propagateComposedEvents to true and rejecting events that should be propagated. See the propagateComposedEvents documentation for details.
By default, MouseArea items only report mouse clicks and not changes to the position of the mouse cursor. Setting the hoverEnabled property ensures that handlers defined for onPositionChanged, onEntered and onExited are used and that the containsMouse property is updated even when no mouse buttons are pressed.
Definition at line 385 of file qquickmousearea.cpp.
QQuickMouseArea::~QQuickMouseArea | ( | ) |
Definition at line 398 of file qquickmousearea.cpp.
Qt::MouseButtons QQuickMouseArea::acceptedButtons | ( | ) | const |
\qmlproperty Qt::MouseButtons QtQuick::MouseArea::acceptedButtons This property holds the mouse buttons that the mouse area reacts to.
To specify that the MouseArea will react to multiple buttons, Qt::MouseButtons flag values are combined using the "|" (or) operator:
To indicate that all possible mouse buttons are to be accepted, the special value 'Qt.AllButtons' may be used:
The default value is Qt.LeftButton
.
Definition at line 1214 of file qquickmousearea.cpp.
|
signal |
|
signal |
|
overrideprotectedvirtual |
Reimplement this method to filter the pointer events that are received by this item's children.
This method will only be called if filtersChildMouseEvents() is true
.
Return true
if the specified event should not be passed on to the specified child item, and false
otherwise. If you return true
, you should also \l {QEvent::accept()}{accept} or \l {QEvent::ignore()}{ignore} the event, to signal if event propagation should stop or continue. The event will, however, always be sent to all childMouseEventFilters up the parent chain.
event->type()
and/or event->device()->type()
to handle different event types in different ways.Reimplemented from QQuickItem.
Definition at line 985 of file qquickmousearea.cpp.
|
signal |
bool QQuickMouseArea::containsPress | ( | ) | const |
\qmlproperty bool QtQuick::MouseArea::containsPress
{pressed
&& containsMouse}, i.e. it holds whether any of the \l acceptedButtons are currently pressed and the mouse is currently within the MouseArea.This property is particularly useful for highlighting an item while the mouse is pressed within its bounds.
Definition at line 1175 of file qquickmousearea.cpp.
|
signal |
|
signal |
|
signal |
|
signal |
|
overrideprotectedvirtual |
This function is called to handle this item's changes in geometry from oldGeometry to newGeometry. If the two geometries are the same, it doesn't do anything.
Derived classes must call the base class method within their implementation.
Reimplemented from QQuickItem.
Definition at line 1035 of file qquickmousearea.cpp.
bool QQuickMouseArea::hovered | ( | ) | const |
\qmlproperty bool QtQuick::MouseArea::containsMouse This property holds whether the mouse is currently inside the mouse area.
false
, containsMouse
will be true
when the mouse is pressed while the mouse cursor is inside the MouseArea. But if you set {mouse.accepted
= false} in an onPressed
handler, containsMouse
will remain false
because the press was rejected. Definition at line 1147 of file qquickmousearea.cpp.
|
signal |
bool QQuickMouseArea::hoverEnabled | ( | ) | const |
\qmlproperty bool QtQuick::MouseArea::hoverEnabled This property holds whether hover events are handled.
By default, mouse events are only handled in response to a button event, or when a button is pressed. Hover enables handling of all mouse events even when no mouse button is pressed.
This property affects the containsMouse property and the onEntered, onExited and onPositionChanged signals.
Definition at line 1120 of file qquickmousearea.cpp.
|
signal |
|
overrideprotectedvirtual |
This event handler can be reimplemented in a subclass to receive hover-enter events for an item.
The event information is provided by the event parameter.
Hover events are only provided if acceptHoverEvents() is true.
\input item.qdocinc accepting-events
Reimplemented from QQuickItem.
Definition at line 807 of file qquickmousearea.cpp.
|
overrideprotectedvirtual |
This event handler can be reimplemented in a subclass to receive hover-leave events for an item.
The event information is provided by the event parameter.
Hover events are only provided if acceptHoverEvents() is true.
\input item.qdocinc accepting-events
Reimplemented from QQuickItem.
Definition at line 857 of file qquickmousearea.cpp.
|
overrideprotectedvirtual |
This event handler can be reimplemented in a subclass to receive hover-move events for an item.
The event information is provided by the event parameter.
Hover events are only provided if acceptHoverEvents() is true.
\input item.qdocinc accepting-events
Reimplemented from QQuickItem.
Definition at line 836 of file qquickmousearea.cpp.
bool QQuickMouseArea::isEnabled | ( | ) | const |
\qmlproperty bool QtQuick::MouseArea::enabled This property holds whether the item accepts mouse events.
By default, this property is true.
Definition at line 443 of file qquickmousearea.cpp.
bool QQuickMouseArea::isPressed | ( | ) | const |
\qmlproperty bool QtQuick::MouseArea::pressed This property holds whether any of the \l acceptedButtons are currently pressed.
Definition at line 1157 of file qquickmousearea.cpp.
bool QQuickMouseArea::isScrollGestureEnabled | ( | ) | const |
\qmlproperty bool QtQuick::MouseArea::scrollGestureEnabled
This property controls whether this MouseArea responds to scroll gestures from non-mouse devices, such as the 2-finger flick gesture on a trackpad. If set to false, the \l wheel signal be emitted only when the wheel event comes from an actual mouse with a wheel, while scroll gesture events will pass through to any other Item that will handle them. For example, the user might perform a flick gesture while the cursor is over an item containing a MouseArea, intending to interact with a Flickable which is underneath. Setting this property to false will allow the PinchArea to handle the mouse wheel or the pinch gesture, while the Flickable handles the flick gesture.
By default, this property is true.
Definition at line 475 of file qquickmousearea.cpp.
|
overrideprotectedvirtual |
Called when change occurs for this item.
value contains extra information relating to the change, when applicable.
If you re-implement this method in a subclass, be sure to call
typically at the end of your implementation, to ensure the \l windowChanged() signal will be emitted.
Reimplemented from QQuickItem.
Definition at line 1046 of file qquickmousearea.cpp.
|
overrideprotectedvirtual |
This event handler can be reimplemented in a subclass to receive mouse double-click events for an item.
The event information is provided by the event parameter.
\input item.qdocinc accepting-events
Reimplemented from QQuickItem.
Definition at line 783 of file qquickmousearea.cpp.
|
overrideprotectedvirtual |
This event handler can be reimplemented in a subclass to receive mouse move events for an item.
The event information is provided by the event parameter.
In order to receive mouse movement events, the preceding mouse press event must be accepted (by overriding \l mousePressEvent(), for example) and \l acceptedMouseButtons() must return the relevant mouse button.
\input item.qdocinc accepting-events
Reimplemented from QQuickItem.
Definition at line 648 of file qquickmousearea.cpp.
|
overrideprotectedvirtual |
This event handler can be reimplemented in a subclass to receive mouse press events for an item.
The event information is provided by the event parameter.
In order to receive mouse press events, \l acceptedMouseButtons() must return the relevant mouse button.
\input item.qdocinc accepting-events
Reimplemented from QQuickItem.
Definition at line 624 of file qquickmousearea.cpp.
|
overrideprotectedvirtual |
This event handler can be reimplemented in a subclass to receive mouse release events for an item.
The event information is provided by the event parameter.
In order to receive mouse release events, the preceding mouse press event must be accepted (by overriding \l mousePressEvent(), for example) and \l acceptedMouseButtons() must return the relevant mouse button.
\input item.qdocinc accepting-events
Reimplemented from QQuickItem.
Definition at line 754 of file qquickmousearea.cpp.
|
overrideprotectedvirtual |
This event handler can be reimplemented in a subclass to be notified when a mouse ungrab event has occurred on this item.
Reimplemented from QQuickItem.
Definition at line 917 of file qquickmousearea.cpp.
qreal QQuickMouseArea::mouseX | ( | ) | const |
\qmlproperty real QtQuick::MouseArea::mouseX \qmlproperty real QtQuick::MouseArea::mouseY These properties hold the coordinates of the mouse cursor.
If the hoverEnabled property is false then these properties will only be valid while a button is pressed, and will remain valid as long as the button is held down even if the mouse is moved outside the area.
By default, this property is false.
If hoverEnabled is true then these properties will be valid when: \list
The coordinates are relative to the MouseArea.
Definition at line 421 of file qquickmousearea.cpp.
|
signal |
qreal QQuickMouseArea::mouseY | ( | ) | const |
Definition at line 427 of file qquickmousearea.cpp.
|
signal |
|
signal |
|
signal |
int QQuickMouseArea::pressAndHoldInterval | ( | ) | const |
\qmlproperty Qt::CursorShape QtQuick::MouseArea::cursorShape This property holds the cursor shape for this mouse area.
Note that on platforms that do not display a mouse cursor this may have no effect.
The available cursor shapes are: \list
In order to only set a mouse cursor shape for a region without reacting to mouse events set the acceptedButtons to none:
The default value is Qt.ArrowCursor
.
cursorShape
property is set to undefined
, the MouseArea
will not change the existing shape when entering it.\qmlproperty int QtQuick::MouseArea::pressAndHoldInterval
This property overrides the elapsed time in milliseconds before pressAndHold
is emitted.
If not explicitly set – or after reset – the value follows QStyleHints::mousePressAndHoldInterval
.
Typically it's sufficient to set this property globally using the application style hint. This property should be used when varying intervals are needed for certain MouseAreas.
Definition at line 1376 of file qquickmousearea.cpp.
|
signal |
Qt::MouseButtons QQuickMouseArea::pressedButtons | ( | ) | const |
\qmlproperty MouseButtons QtQuick::MouseArea::pressedButtons This property holds the mouse buttons currently pressed.
It contains a bitwise combination of: \list
The code below displays "right" when the right mouse buttons is pressed:
Definition at line 618 of file qquickmousearea.cpp.
|
signal |
|
signal |
bool QQuickMouseArea::preventStealing | ( | ) | const |
\qmlproperty bool QtQuick::MouseArea::preventStealing This property holds whether the mouse events may be stolen from this MouseArea.
If a MouseArea is placed within an item that filters child mouse events, such as Flickable, the mouse events may be stolen from the MouseArea if a gesture is recognized by the parent item, e.g. a flick gesture. If preventStealing is set to true, no item will steal the mouse events.
Note that setting preventStealing to true once an item has started stealing events will have no effect until the next press event.
By default this property is false.
Definition at line 506 of file qquickmousearea.cpp.
|
signal |
bool QQuickMouseArea::propagateComposedEvents | ( | ) | const |
\qmlproperty bool QtQuick::MouseArea::propagateComposedEvents This property holds whether composed mouse events will automatically propagate to other MouseAreas that overlap with this MouseArea but are lower in the visual stacking order.
By default, this property is false.
MouseArea contains several composed events: clicked
, doubleClicked
and pressAndHold
. These are composed of basic mouse events, like pressed
, and can be propagated differently in comparison to basic events.
If propagateComposedEvents is set to true, then composed events will be automatically propagated to other MouseAreas in the same location in the scene. Each event is propagated to the next \l enabled MouseArea beneath it in the stacking order, propagating down this visual hierarchy until a MouseArea accepts the event. Unlike pressed
events, composed events will not be automatically accepted if no handler is present.
For example, below is a yellow \l Rectangle that contains a blue \l Rectangle. The blue rectangle is the top-most item in the hierarchy of the visual stacking order; it will visually rendered above the yellow rectangle. Since the blue rectangle sets propagateComposedEvents to true, and also sets \l MouseEvent::accepted to false for all received clicked
events, any clicked
events it receives are propagated to the MouseArea of the yellow rectangle beneath it.
\qml import QtQuick 2.0
Rectangle { color: "yellow" width: 100; height: 100
MouseArea { anchors.fill: parent onClicked: console.log("clicked yellow") }
Rectangle { color: "blue" width: 50; height: 50
MouseArea { anchors.fill: parent propagateComposedEvents: true onClicked: (mouse)=> { console.log("clicked blue") mouse.accepted = false } } } } \endqml
Clicking on the blue rectangle will cause the onClicked
handler of its child MouseArea to be invoked; the event will then be propagated to the MouseArea of the yellow rectangle, causing its own onClicked
handler to be invoked.
This property greatly simplifies the usecase of when you want to have overlapping MouseAreas handling the composed events together. For example: if you want one MouseArea to handle clicked
signals and the other to handle pressAndHold
, or if you want one MouseArea to handle clicked
most of the time, but pass it through when certain conditions are met.
Definition at line 583 of file qquickmousearea.cpp.
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
void QQuickMouseArea::resetPressAndHoldInterval | ( | ) |
Definition at line 1392 of file qquickmousearea.cpp.
|
protected |
Definition at line 928 of file qquickmousearea.cpp.
void QQuickMouseArea::setAcceptedButtons | ( | Qt::MouseButtons | buttons | ) |
Definition at line 1219 of file qquickmousearea.cpp.
void QQuickMouseArea::setEnabled | ( | bool | a | ) |
Definition at line 449 of file qquickmousearea.cpp.
|
protected |
Definition at line 1181 of file qquickmousearea.cpp.
void QQuickMouseArea::setHoverEnabled | ( | bool | h | ) |
Definition at line 1125 of file qquickmousearea.cpp.
void QQuickMouseArea::setPressAndHoldInterval | ( | int | interval | ) |
Definition at line 1383 of file qquickmousearea.cpp.
|
protected |
Definition at line 1227 of file qquickmousearea.cpp.
void QQuickMouseArea::setPreventStealing | ( | bool | prevent | ) |
Definition at line 512 of file qquickmousearea.cpp.
void QQuickMouseArea::setPropagateComposedEvents | ( | bool | propagate | ) |
Definition at line 589 of file qquickmousearea.cpp.
void QQuickMouseArea::setScrollGestureEnabled | ( | bool | e | ) |
Definition at line 481 of file qquickmousearea.cpp.
|
overrideprotectedvirtual |
This event handler can be reimplemented in a subclass to receive timer events for the object.
QChronoTimer provides higher-level interfaces to the timer functionality, and also more general information about timers. The timer event is passed in the event parameter.
Reimplemented from QObject.
Definition at line 1008 of file qquickmousearea.cpp.
|
overrideprotectedvirtual |
This event handler can be reimplemented in a subclass to be notified when a touch ungrab event has occurred on this item.
Reimplemented from QQuickItem.
Definition at line 922 of file qquickmousearea.cpp.
|
overrideprotectedvirtual |
\qmlpropertygroup QtQuick::MouseArea::drag \qmlproperty Item QtQuick::MouseArea::drag.target \qmlproperty bool QtQuick::MouseArea::drag.active \qmlproperty enumeration QtQuick::MouseArea::drag.axis \qmlproperty real QtQuick::MouseArea::drag.minimumX \qmlproperty real QtQuick::MouseArea::drag.maximumX \qmlproperty real QtQuick::MouseArea::drag.minimumY \qmlproperty real QtQuick::MouseArea::drag.maximumY \qmlproperty bool QtQuick::MouseArea::drag.filterChildren \qmlproperty real QtQuick::MouseArea::drag.threshold \qmlproperty bool QtQuick::MouseArea::drag.smoothed
drag
provides a convenient way to make an item draggable.
\list
drag.target
specifies the id of the item to drag. drag.active
specifies if the target item is currently being dragged. drag.axis
specifies whether dragging can be done horizontally (Drag.XAxis
), vertically (Drag.YAxis
), or both (Drag.XAndYAxis
) drag.minimum
and drag.maximum
limit how far the target can be dragged along the corresponding axes. \endlistThe following example displays a \l Rectangle that can be dragged along the X-axis. The opacity of the rectangle is reduced when it is dragged to the right.
drag.axis
. For example, if anchors.left
or anchors.right
was set for rect
in the above example, it cannot be dragged along the X-axis. This can be avoided by settng the anchor value to undefined
in an \l {pressed}{onPressed} handler.If drag.filterChildren
is set to true, a drag can override descendant MouseAreas. This enables a parent MouseArea to handle drags, for example, while descendants handle clicks:
drag.threshold
determines the threshold in pixels of when the drag operation should start. By default this is bound to a platform dependent value. This property was added in Qt Quick 2.2.
If drag.smoothed
is true
, the target will be moved only after the drag operation has started. If set to false
, the target will be moved straight to the current mouse position. By default, this property is true
. This property was added in Qt Quick 2.4
See the \l Drag attached property and \l DropArea if you want to make a drop.
Reimplemented from QQuickItem.
Definition at line 1460 of file qquickmousearea.cpp.
|
readwrite |
Definition at line 40 of file qquickmousearea_p.h.
|
read |
Definition at line 35 of file qquickmousearea_p.h.
|
read |
Definition at line 50 of file qquickmousearea_p.h.
|
readwrite |
Definition at line 37 of file qquickmousearea_p.h.
|
readwrite |
Definition at line 41 of file qquickmousearea_p.h.
|
read |
Definition at line 33 of file qquickmousearea_p.h.
|
read |
Definition at line 34 of file qquickmousearea_p.h.
|
readwrite |
Definition at line 51 of file qquickmousearea_p.h.
|
read |
Definition at line 36 of file qquickmousearea_p.h.
|
read |
Definition at line 39 of file qquickmousearea_p.h.
|
readwrite |
Definition at line 45 of file qquickmousearea_p.h.
|
readwrite |
Definition at line 46 of file qquickmousearea_p.h.
|
readwrite |
Definition at line 38 of file qquickmousearea_p.h.