Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}. More...
#include <qquickitem.h>
Inherits QObject, and QQmlParserStatus.
Inherited by QDeclarativeGeoMap, QDeclarativeGeoMapItemBase, QDeclarativeGeoMapItemGroup, QGfxSourceProxyME, QQuick3DViewport, QQuickAnimatedSprite, QQuickBasicBusyIndicator, QQuickBasicProgressBar, QQuickCanvasItem, QQuickColorInputs, QQuickContentItem, QQuickControl, QQuickDropArea, QQuickFlickable, QQuickFlickableContentItem, QQuickFlickableContentItem, QQuickFlipable, QQuickFocusScope, QQuickFramebufferObject, QQuickIconLabel, QQuickImplicitSizeItem, QQuickLayout, QQuickLayoutItemProxy, QQuickMaterialBusyIndicator, QQuickMaterialProgressBar, QQuickMaterialRipple, QQuickMouseArea, QQuickMultiEffect, QQuickMultiPointTouchArea, QQuickOverlay, QQuickPaintedItem, QQuickParticleAffector, QQuickParticleEmitter, QQuickParticlePainter, QQuickParticleSystem, QQuickPathView, QQuickPdfSelection, QQuickPinchArea, QQuickRectangle, QQuickRectangularShadow, QQuickRepeater, QQuickRhiItem, QQuickRootItem, QQuickShaderEffect, QQuickShaderEffectSource, QQuickShape, QQuickSpriteSequence, QQuickStyleItem, QQuickTumblerView, QQuickUniversalBusyIndicator, QQuickUniversalProgressBar, QQuickVectorImage, QQuickVectorImageGenerator::Utils::ViewBoxItem, QQuickVideoOutput, QWaylandMouseTracker, QWaylandQtShellChrome, and QWaylandQuickItem.
Classes | |
class | ItemChangeData |
\inmodule QtQuick More... | |
struct | UpdatePaintNodeData |
Public Slots | |
void | update () |
Schedules a call to updatePaintNode() for this item. | |
Public Slots inherited from QObject | |
void | deleteLater () |
\threadsafe | |
Public Member Functions | |
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 () |
Public Attributes | |
const QSize & | targetSize = QSize()) |
qreal y | const |
Protected Member Functions | |
bool | event (QEvent *) override |
\reimp | |
bool | isComponentComplete () const |
Returns true if construction of the QML component is complete; otherwise returns false. | |
virtual void | itemChange (ItemChange, const ItemChangeData &) |
Called when change occurs for this item. | |
virtual void | geometryChange (const QRectF &newGeometry, const QRectF &oldGeometry) |
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 | mousePressEvent (QMouseEvent *event) |
This event handler can be reimplemented in a subclass to receive mouse press events for an item. | |
virtual void | mouseMoveEvent (QMouseEvent *event) |
This event handler can be reimplemented in a subclass to receive mouse move events for an item. | |
virtual void | mouseReleaseEvent (QMouseEvent *event) |
This event handler can be reimplemented in a subclass to receive mouse release events for an item. | |
virtual void | mouseDoubleClickEvent (QMouseEvent *event) |
This event handler can be reimplemented in a subclass to receive mouse double-click events for an item. | |
virtual void | mouseUngrabEvent () |
This event handler can be reimplemented in a subclass to be notified when a mouse ungrab event has occurred on this item. | |
virtual void | touchUngrabEvent () |
This event handler can be reimplemented in a subclass to be notified when a touch ungrab event has occurred on this item. | |
virtual void | touchEvent (QTouchEvent *event) |
This event handler can be reimplemented in a subclass to receive touch events for an item. | |
virtual void | hoverEnterEvent (QHoverEvent *event) |
This event handler can be reimplemented in a subclass to receive hover-enter events for an item. | |
virtual void | hoverMoveEvent (QHoverEvent *event) |
This event handler can be reimplemented in a subclass to receive hover-move events for an item. | |
virtual void | hoverLeaveEvent (QHoverEvent *event) |
This event handler can be reimplemented in a subclass to receive hover-leave events for an item. | |
virtual bool | childMouseEventFilter (QQuickItem *, QEvent *) |
Reimplement this method to filter the pointer events that are received by this item's children. | |
virtual QSGNode * | updatePaintNode (QSGNode *, UpdatePaintNodeData *) |
Called on the render thread when it is time to sync the state of the item with the scene graph. | |
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 | timerEvent (QTimerEvent *event) |
This event handler can be reimplemented in a subclass to receive timer events for the object. | |
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 | |
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 | |
Friends | |
class | QQuickDeliveryAgentPrivate |
class | QSGRenderer |
class | QAccessibleQuickItem |
class | QQuickAccessibleAttached |
class | QQuickAnchorChanges |
Q_QUICK_EXPORT QDebug | operator<< (QDebug debug, QQuickItem *item) |
Additional Inherited Members | |
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) |
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) | |
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
\inmodule QtQuick
All visual items in Qt Quick inherit from QQuickItem. Although a QQuickItem instance has no visual appearance, it defines all the attributes that are common across visual items, such as x and y position, width and height, \l {Positioning with Anchors}{anchoring} and key handling support.
You can subclass QQuickItem to provide your own custom visual item that inherits these features.
Definition at line 62 of file qquickitem.h.
enum QQuickItem::Flag |
\qmltype Item \nativetype QQuickItem \inherits QtObject \inqmlmodule QtQuick
A basic visual QML type.
The Item type is the base type for all visual items in Qt Quick.
All visual items in Qt Quick inherit from Item. Although an Item object has no visual appearance, it defines all the attributes that are common across visual items, such as x and y position, width and height, \l {Positioning with Anchors}{anchoring} and key handling support.
The Item type can be useful for grouping several items under a single root visual item. For example:
\qml import QtQuick 2.0
Item { Image { source: "tile.png" } Image { x: 80 width: 100 height: 100 source: "tile.png" } Image { x: 190 width: 100 height: 100 fillMode: Image.Tile source: "tile.png" } } \endqml
Enumerator | |
---|---|
ItemClipsChildrenToShape | |
ItemIsFocusScope | |
ItemHasContents | |
ItemAcceptsDrops | |
ItemIsViewport | |
ItemObservesViewport |
Definition at line 129 of file qquickitem.h.
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
\value ItemChildAddedChange A child was added. ItemChangeData::item contains the added child.
\value ItemChildRemovedChange A child was removed. ItemChangeData::item contains the removed child.
\value ItemSceneChange The item was added to or removed from a scene. The QQuickWindow rendering the scene is specified in using ItemChangeData::window. The window parameter is null when the item is removed from a scene.
\value ItemVisibleHasChanged The item's visibility has changed. ItemChangeData::boolValue contains the new visibility.
\value ItemParentHasChanged The item's parent has changed. ItemChangeData::item contains the new parent.
\value ItemOpacityHasChanged The item's opacity has changed. ItemChangeData::realValue contains the new opacity.
\value ItemActiveFocusHasChanged The item's focus has changed. ItemChangeData::boolValue contains whether the item has focus or not.
\value ItemRotationHasChanged The item's rotation has changed. ItemChangeData::realValue contains the new rotation.
\value ItemDevicePixelRatioHasChanged The device pixel ratio of the screen the item is on has changed. ItemChangedData::realValue contains the new device pixel ratio.
\value ItemAntialiasingHasChanged The antialiasing has changed. The current (boolean) value can be found in QQuickItem::antialiasing.
\value ItemEnabledHasChanged The item's enabled state has changed. ItemChangeData::boolValue contains the new enabled state. (since Qt 5.10)
\value ItemScaleHasChanged The item's scale has changed. ItemChangeData::realValue contains the scale. (since Qt 6.9)
\value ItemTransformHasChanged The item's transform has changed. This occurs when the item's position, size, rotation, scale, transformOrigin or attached transforms change. (since Qt 6.9)
Definition at line 144 of file qquickitem.h.
\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}.
\variable QQuickItem::ItemChangeData::boolValue The boolean value that has changed: \l {QQuickItem::isVisible()}{visible}, \l {QQuickItem::isEnabled()}{enabled}, \l {QQuickItem::hasActiveFocus()}{activeFocus}, or \l {QQuickItem::antialiasing()}{antialiasing}.
\variable QQuickItem::ItemChangeData::item The item that has been added or removed as a \l{QQuickItem::childItems()}{child}, or the new \l{QQuickItem::parentItem()}{parent}.
\variable QQuickItem::ItemChangeData::window The \l{QQuickWindow}{window} in which the item has been shown, or nullptr
if the item has been removed from a window.
Controls the point about which simple transforms like scale apply.
\value TopLeft The top-left corner of the item. \value Top The center point of the top of the item. \value TopRight The top-right corner of the item. \value Left The left most point of the vertical middle. \value Center The center of the item. \value Right The right most point of the vertical middle. \value BottomLeft The bottom-left corner of the item. \value Bottom The center point of the bottom of the item. \value BottomRight The bottom-right corner of the item.
Enumerator | |
---|---|
TopLeft | |
Top | |
TopRight | |
Left | |
Center | |
Right | |
BottomLeft | |
Bottom | |
BottomRight |
Definition at line 173 of file qquickitem.h.
|
explicit |
Constructs a QQuickItem with the given parent.
The parent
will be used as both the \l {setParentItem()}{visual parent} and the \l QObject parent.
Definition at line 2358 of file qquickitem.cpp.
|
override |
Destroys the QQuickItem.
Definition at line 2377 of file qquickitem.cpp.
|
protected |
Definition at line 2367 of file qquickitem.cpp.
Qt::MouseButtons QQuickItem::acceptedMouseButtons | ( | ) | const |
Returns the mouse buttons accepted by this item.
The default value is Qt::NoButton; that is, no mouse buttons are accepted.
If an item does not accept the mouse button for a particular mouse event, the mouse event will not be delivered to the item and will be delivered to the next item in the item hierarchy instead.
Definition at line 8067 of file qquickitem.cpp.
bool QQuickItem::acceptHoverEvents | ( | ) | const |
Returns whether hover events are accepted by this item.
The default value is false.
If this is false, then the item will not receive any hover events through the hoverEnterEvent(), hoverMoveEvent() and hoverLeaveEvent() functions.
Definition at line 8153 of file qquickitem.cpp.
bool QQuickItem::acceptTouchEvents | ( | ) | const |
Returns whether touch events are accepted by this item.
The default value is false
.
If this is false
, then the item will not receive any touch events through the touchEvent() function.
Definition at line 8186 of file qquickitem.cpp.
|
signal |
bool QQuickItem::activeFocusOnTab | ( | ) | const |
\qmlproperty bool QtQuick::Item::activeFocusOnTab
This property holds whether the item wants to be in the tab focus chain. By default, this is set to false
.
The tab focus chain traverses elements by first visiting the parent, and then its children in the order they occur in the children property. Pressing the tab key on an item in the tab focus chain will move keyboard focus to the next item in the chain. Pressing BackTab (normally Shift+Tab) will move focus to the previous item.
To set up a manual tab focus chain, see \l KeyNavigation. Tab key events used by Keys or KeyNavigation have precedence over focus chain behavior; ignore the events in other key handlers to allow it to propagate.
This property holds whether the item wants to be in the tab focus chain. By default, this is set to false
.
Definition at line 7005 of file qquickitem.cpp.
bool QQuickItem::antialiasing | ( | ) | const |
Definition at line 7047 of file qquickitem.cpp.
|
signal |
qreal QQuickItem::baselineOffset | ( | ) | const |
\qmlproperty int QtQuick::Item::baselineOffset
Specifies the position of the item's baseline in local coordinates.
The baseline of a \l Text item is the imaginary line on which the text sits. Controls containing text usually set their baseline to the baseline of their text.
For non-text items, a default baseline offset of 0 is used.
Specifies the position of the item's baseline in local coordinates.
The baseline of a \l Text item is the imaginary line on which the text sits. Controls containing text usually set their baseline to the baseline of their text.
For non-text items, a default baseline offset of 0 is used.
Definition at line 4548 of file qquickitem.cpp.
Definition at line 7584 of file qquickitem.cpp.
Definition at line 7375 of file qquickitem.cpp.
Definition at line 7304 of file qquickitem.cpp.
Definition at line 7309 of file qquickitem.cpp.
|
virtual |
Returns the extents of the item in its own coordinate system: a rectangle from {0, 0} to \l width() and \l height().
Reimplemented in QQuickImage, QQuickText, QQuickTextEdit, and QQuickTextInput.
Definition at line 5815 of file qquickitem.cpp.
QQuickItem * QQuickItem::childAt | ( | qreal | x, |
qreal | y ) const |
\qmlmethod QtQuick::Item::childAt(real x, real y)
Returns the first visible child item found at point (x, y) within the coordinate system of this item.
Returns null
if there is no such item.
Returns the first visible child item found at point (x, y) within the coordinate system of this item.
Returns \nullptr if there is no such item.
Definition at line 5032 of file qquickitem.cpp.
QList< QQuickItem * > QQuickItem::childItems | ( | ) | const |
Returns the children of this item.
Definition at line 3821 of file qquickitem.cpp.
|
protectedvirtual |
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 in QQuickFlickable, QQuickMouseArea, QQuickMultiPointTouchArea, QQuickOverlay, QQuickPathView, QQuickPinchArea, QQuickPopupItem, QQuickScrollView, QQuickSplitView, QQuickStackView, QQuickSwipeDelegate, and QWaylandMouseTracker.
Definition at line 4416 of file qquickitem.cpp.
|
signal |
QRectF QQuickItem::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
This read-only property holds the collective position and size of the item's children.
This property is useful if you need to access the collective geometry of an item's children in order to correctly size the item.
The geometry that is returned is local to the item. For example:
This property holds the collective position and size of the item's children.
This property is useful if you need to access the collective geometry of an item's children in order to correctly size the item.
The geometry that is returned is local to the item. For example:
Definition at line 3807 of file qquickitem.cpp.
|
overrideprotectedvirtual |
\reimp Derived classes should call the base class method before adding their own action to perform at classBegin.
Implements QQmlParserStatus.
Reimplemented in QQuickLabel, QQuickRangeSlider, QQuickScrollBar, QQuickShape, QQuickSpinBox, QQuickTextArea, QQuickTextField, and QQuickWindowContainer.
Definition at line 5332 of file qquickitem.cpp.
bool QQuickItem::clip | ( | ) | const |
\qmlproperty bool QtQuick::Item::clip This property holds whether clipping is enabled.
The default clip value is false
.
If clipping is enabled, an item will clip its own painting, as well as the painting of its children, to its bounding rectangle.
This property holds whether clipping is enabled. The default clip value is false
.
If clipping is enabled, an item will clip its own painting, as well as the painting of its children, to its bounding rectangle. If you set clipping during an item's paint operation, remember to re-set it to prevent clipping the rest of your scene.
true
also sets the \l ItemIsViewport flag, which sometimes acts as an optimization: child items that have the \l ItemObservesViewport flag may forego creating scene graph nodes that fall outside the viewport. But the ItemIsViewport
flag can also be set independently. Definition at line 3855 of file qquickitem.cpp.
|
signal |
|
virtual |
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().
This is the region intended to remain visible if \l clip is true
. It can also be used in updatePaintNode() to limit the graphics added to the scene graph.
For example, a large drawing or a large text document might be shown in a Flickable that occupies only part of the application's Window: in that case, Flickable is the viewport item, and a custom content-rendering item may choose to omit scene graph nodes that fall outside the area that is currently visible. If the \l ItemObservesViewport flag is set, this area will change each time the user scrolls the content in the Flickable.
In case of nested viewport items, clipRect() is the intersection of the {boundingRect}s
of all ancestors that have the \l ItemIsViewport flag set, mapped to the coordinate system of this item.
Reimplemented in QQuickClippedText, QQuickText, QQuickTextEdit, QQuickTextInput, and QQuickWindowContainer.
Definition at line 5842 of file qquickitem.cpp.
|
overrideprotectedvirtual |
\reimp Derived classes should call the base class method before adding their own actions to perform at componentComplete.
Implements QQmlParserStatus.
Reimplemented in QQuickItemView, QQuickLabel, QQuickLayout, QQuickLoader, QQuickMaterialPlaceholderText, QQuickMaterialTextContainer, QQuickMenuBar, QQuickMenuItem, QQuickMonthGrid, QQuickMultiEffect, QQuickPage, QQuickPane, QQuickParticleAffector, QQuickParticleEmitter, QQuickParticlePainter, QQuickParticleSystem, QQuickPathView, QQuickPlaceholderText, QQuickProgressBar, QQuickRangeSlider, QQuickRectangularShadow, QQuickRepeater, QQuickScrollBar, QQuickScrollView, QQuickShaderEffect, QQuickShape, QQuickSlider, QQuickSpinBox, QQuickSplitView, QQuickStackLayout, QQuickStackView, QQuickStyleItem, QQuickSwipeDelegate, QQuickSwipeView, QQuickTabBar, QQuickText, QQuickTextArea, QQuickTextEdit, QQuickTextField, QQuickTextInput, QQuickTreeViewDelegate, QQuickTumbler, QQuickTumblerView, QQuickWeekNumberColumn, and QQuickWindowContainer.
Definition at line 5351 of file qquickitem.cpp.
QObject * QQuickItem::containmentMask | ( | ) | const |
Definition at line 8734 of file qquickitem.cpp.
\qmlmethod bool QtQuick::Item::contains(point point)
Returns true
if this item contains point, which is in local coordinates; returns false
otherwise. This is the same check that is used for hit-testing a QEventPoint during event delivery, and is affected by \l containmentMask if it is set.
Returns true
if this item contains point, which is in local coordinates; returns false
otherwise.
This function can be overridden in order to handle point collisions in items with custom shapes. The default implementation checks whether the point is inside \l containmentMask() if it is set, or inside the bounding box otherwise.
Reimplemented in QDeclarativeCircleMapItem, QDeclarativePolygonMapItem, QDeclarativePolylineMapItem, QDeclarativeRectangleMapItem, QQuickFlickableContentItem, QQuickFlickableContentItem, QQuickShape, and QQuickTextArea.
Definition at line 8650 of file qquickitem.cpp.
|
signal |
|
overrideprotectedvirtual |
\reimp
Reimplemented from QObject.
Reimplemented in QQuickMenuBarItem, QQuickPinchArea, QQuickRhiItem, QQuickShaderEffect, QQuickStyleItem, QQuickTextEdit, and QQuickTextInput.
Definition at line 9061 of file qquickitem.cpp.
bool QQuickItem::filtersChildMouseEvents | ( | ) | const |
Returns whether pointer events intended for this item's children should be filtered through this item.
If both this item and a child item have acceptTouchEvents() true
, then when a touch interaction occurs, this item will filter the touch event. But if either this item or the child cannot handle touch events, childMouseEventFilter() will be called with a synthesized mouse event.
Definition at line 8105 of file qquickitem.cpp.
QQuickItem::Flags QQuickItem::flags | ( | ) | const |
Returns the item flags for this item.
Definition at line 7099 of file qquickitem.cpp.
|
signal |
|
protectedvirtual |
This event handler can be reimplemented in a subclass to receive focus-in events for an item.
The event information is provided by the event parameter.
\input item.qdocinc accepting-events
If you do reimplement this function, you should call the base class implementation.
Reimplemented in QQuickComboBox, QQuickControl, QQuickPopupItem, QQuickRangeSlider, QQuickSpinBox, QQuickTextArea, QQuickTextEdit, QQuickTextField, and QQuickTextInput.
Definition at line 4144 of file qquickitem.cpp.
|
protectedvirtual |
This event handler can be reimplemented in a subclass to receive focus-out events for an item.
The event information is provided by the event parameter.
\input item.qdocinc accepting-events
Reimplemented in QQuickAbstractButton, QQuickComboBox, QQuickControl, QQuickPopupItem, QQuickTextArea, QQuickTextEdit, QQuickTextField, and QQuickTextInput.
Definition at line 4165 of file qquickitem.cpp.
Qt::FocusPolicy QQuickItem::focusPolicy | ( | ) | const |
Definition at line 8011 of file qquickitem.cpp.
void QQuickItem::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)
Maps the point (x, y) or rect (x, y, width, height), which is in this item's coordinate system, to item's coordinate system, and returns a \l point or \l rect matching the mapped coordinate.
\input item.qdocinc mapping
If item is a null
value, this maps the point or rect to the coordinate system of the \l{Scene Coordinates}{scene}.
The versions accepting point and rect are since Qt 5.15.
Maps the point (x, y), which is in this item's coordinate system, to the global coordinate system, and returns a \l point matching the mapped coordinate.
\input item.qdocinc mapping
\qmlmethod QtQuick::Item::forceActiveFocus()
Forces active focus on the item.
This method sets focus on the item and ensures that all ancestor FocusScope objects in the object hierarchy are also given \l focus.
The reason for the focus change will be \l [CPP] Qt::OtherFocusReason. Use the overloaded method to specify the focus reason to enable better handling of the focus change.
Forces active focus on the item.
This method sets focus on the item and ensures that all ancestor FocusScope objects in the object hierarchy are also given \l focus.
The reason for the focus change will be \l [CPP] Qt::OtherFocusReason. Use the overloaded method to specify the focus reason to enable better handling of the focus change.
Definition at line 4951 of file qquickitem.cpp.
void QQuickItem::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.
This method sets focus on the item and ensures that all ancestor FocusScope objects in the object hierarchy are also given \l focus.
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.
This method sets focus on the item and ensures that all ancestor FocusScope objects in the object hierarchy are also given \l focus.
Definition at line 4981 of file qquickitem.cpp.
|
protectedvirtual |
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 in QDeclarativeCircleMapItem, QDeclarativeGeoMap, QDeclarativeGeoMapQuickItem, QDeclarativePolygonMapItem, QDeclarativePolylineMapItem, QDeclarativeRectangleMapItem, QQuick3DViewport, QQuickCanvasItem, QQuickControl, QQuickDayOfWeekRow, QQuickDialogButtonBox, QQuickFlickable, QQuickFramebufferObject, QQuickGridView, QQuickIconImage, QQuickIconLabel, QQuickImage, QQuickItemGroup, QQuickItemView, QQuickLabel, QQuickLayout, QQuickLayoutItemProxy, QQuickListView, QQuickLoader, QQuickMenuBarItem, QQuickMonthGrid, QQuickMouseArea, QQuickMultiEffect, QQuickOverlay, QQuickPinchArea, QQuickPopupItem, QQuickRectangularShadow, QQuickRhiItem, QQuickRoundButton, QQuickShaderEffect, QQuickSplitView, QQuickStackView, QQuickStyleItem, QQuickSwipeDelegate, QQuickSwipeView, QQuickTabBar, QQuickTableView, QQuickText, QQuickTextArea, QQuickTextEdit, QQuickTextField, QQuickTextInput, QQuickTreeViewDelegate, QQuickTumbler, QQuickTumblerView, QQuickTurbulenceAffector, QQuickVectorImageGenerator::Utils::ViewBoxItem, QQuickVideoOutput, QQuickWeekNumberColumn, and QQuickWindowContainer.
Definition at line 3883 of file qquickitem.cpp.
void QQuickItem::grabMouse | ( | ) |
Grabs the mouse input.
This item will receive all mouse events until ungrabMouse() is called. Usually this function should not be called, since accepting for example a mouse press event makes sure that the following events are delivered to the item. If an item wants to take over mouse events from the current receiver, it needs to call this function.
Grabs the mouse input.
This item will receive all mouse events until ungrabMouse() is called. Usually this function should not be called, since accepting for example a mouse press event makes sure that the following events are delivered to the item. If an item wants to take over mouse events from the current receiver, it needs to call this function.
Definition at line 8482 of file qquickitem.cpp.
Grabs the item into an in-memory image.
\qmlmethod bool QtQuick::Item::grabToImage(callback, targetSize)
The grab happens asynchronously and the signal QQuickItemGrabResult::ready() is emitted when the grab has been completed.
Use targetSize to specify the size of the target image. By default, the result will have the same size as item.
If the grab could not be initiated, the function returns null
.
Grabs the item into an in-memory image.
The grab happens asynchronously and the JavaScript function callback is invoked when the grab is completed. The callback takes one argument, which is the result of the grab operation; an \l ItemGrabResult object.
Use targetSize to specify the size of the target image. By default, the result will have the same size as the item.
If the grab could not be initiated, the function returns false
.
The following snippet shows how to grab an item and store the results in a file:
The following snippet shows how to grab an item and use the results in another image element:
Only visible from QML.
Definition at line 330 of file qquickitemgrabresult.cpp.
These touch points will be owned by the item until they are released. Alternatively, the grab can be stolen by a filtering item like Flickable. Use setKeepTouchGrab() to prevent the grab from being stolen.
These touch points will be owned by the item until they are released. Alternatively, the grab can be stolen by a filtering item like Flickable. Use setKeepTouchGrab() to prevent the grab from being stolen.
Definition at line 8569 of file qquickitem.cpp.
bool QQuickItem::hasActiveFocus | ( | ) | const |
Definition at line 7800 of file qquickitem.cpp.
bool QQuickItem::hasFocus | ( | ) | const |
Definition at line 7894 of file qquickitem.cpp.
qreal QQuickItem::height | ( | ) | const |
Definition at line 7524 of file qquickitem.cpp.
|
signal |
|
protected |
Returns whether the height property has been set explicitly.
Definition at line 7678 of file qquickitem.cpp.
|
protectedvirtual |
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 in QQuickMouseArea, QQuickRangeSlider, QQuickSpinBox, QQuickText, QQuickTextEdit, QWaylandMouseTracker, and QWaylandQuickItem.
Definition at line 4283 of file qquickitem.cpp.
|
protectedvirtual |
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 in QQuickMenuBar, QQuickMouseArea, QQuickRangeSlider, QQuickSpinBox, QQuickSplitView, QQuickText, QQuickTextEdit, QWaylandMouseTracker, and QWaylandQuickItem.
Definition at line 4311 of file qquickitem.cpp.
|
protectedvirtual |
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 in QQuickMouseArea, QQuickRangeSlider, QQuickSpinBox, QQuickSplitView, QQuickText, QQuickTextEdit, QWaylandMouseTracker, and QWaylandQuickItem.
Definition at line 4297 of file qquickitem.cpp.
qreal QQuickItem::implicitHeight | ( | ) | const |
Definition at line 7578 of file qquickitem.cpp.
|
signal |
qreal QQuickItem::implicitWidth | ( | ) | const |
Returns the width of the item that is implied by other properties that determine the content.
Definition at line 7369 of file qquickitem.cpp.
|
signal |
bool QQuickItem::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).
Definition at line 8044 of file qquickitem.cpp.
|
protected |
Returns true if construction of the QML component is complete; otherwise returns false.
It is often desirable to delay some processing until the component is completed.
Definition at line 3230 of file qquickitem.cpp.
bool QQuickItem::isEnabled | ( | ) | const |
Definition at line 6578 of file qquickitem.cpp.
bool QQuickItem::isFocusScope | ( | ) | const |
Returns true if this item is a focus scope, and false otherwise.
Definition at line 7970 of file qquickitem.cpp.
|
virtual |
Returns true if this item is a texture provider.
The default implementation returns false.
This function can be called from any thread.
Reimplemented in QQuick3DViewport, QQuickCanvasItem, QQuickFramebufferObject, QQuickImage, QQuickPaintedItem, QQuickRhiItem, QQuickShaderEffectSource, and QWaylandQuickItem.
Definition at line 9221 of file qquickitem.cpp.
bool QQuickItem::isUnderMouse | ( | ) | const |
Definition at line 8129 of file qquickitem.cpp.
bool QQuickItem::isVisible | ( | ) | const |
Definition at line 6511 of file qquickitem.cpp.
|
protectedvirtual |
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 in QDeclarativeGeoMap, QQuick3DViewport, QQuickAbstractButton, QQuickAnimatedSprite, QQuickBasePositioner, QQuickBasicBusyIndicator, QQuickBasicProgressBar, QQuickCanvasItem, QQuickComboBox, QQuickContainer, QQuickControl, QQuickFolderBreadcrumbBar, QQuickFusionBusyIndicator, QQuickIconImage, QQuickImageBase, QQuickItemGroup, QQuickLabel, QQuickLayout, QQuickLayoutItemProxy, QQuickLoader, QQuickMaterialBusyIndicator, QQuickMaterialProgressBar, QQuickMaterialRipple, QQuickMenuBar, QQuickMouseArea, QQuickMultiEffect, QQuickOverlay, QQuickPaintedItem, QQuickParticlePainter, QQuickPinchArea, QQuickPopupItem, QQuickRectangularShadow, QQuickRepeater, QQuickShaderEffect, QQuickShaderEffectSource, QQuickShape, QQuickSpinBox, QQuickStackLayout, QQuickStyleItem, QQuickText, QQuickTextArea, QQuickTextEdit, QQuickTextField, QQuickTextInput, QQuickTumblerView, QQuickUniversalBusyIndicator, QQuickUniversalProgressBar, QQuickVideoOutput, and QQuickWindowContainer.
Definition at line 5793 of file qquickitem.cpp.
QTransform QQuickItem::itemTransform | ( | QQuickItem * | other, |
bool * | ok ) 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)
Maps the point (x, y) or rect (x, y, width, height), which is in item's coordinate system, to this item's coordinate system, and returns a \l point or \l rect matching the mapped coordinate.
\input item.qdocinc mapping
If item is a null
value, this maps the point or rect from the coordinate system of the \l{Scene Coordinates}{scene}.
The versions accepting point and rect are since Qt 5.15.
Definition at line 4767 of file qquickitem.cpp.
bool QQuickItem::keepMouseGrab | ( | ) | const |
Returns whether mouse input should exclusively remain with this item.
Definition at line 8532 of file qquickitem.cpp.
bool QQuickItem::keepTouchGrab | ( | ) | const |
Returns whether the touch points grabbed by this item should exclusively remain with this item.
Definition at line 8602 of file qquickitem.cpp.
This event handler can be reimplemented in a subclass to receive key press events for an item.
The event information is provided by the event parameter.
\input item.qdocinc accepting-events
Reimplemented in QQuickAbstractButton, QQuickComboBox, QQuickDial, QQuickFolderBreadcrumbBar, QQuickGridView, QQuickListView, QQuickMenuBar, QQuickMenuBarItem, QQuickPopupItem, QQuickRangeSlider, QQuickScrollView, QQuickSlider, QQuickSpinBox, QQuickTableView, QQuickTextEdit, QQuickTextInput, QQuickTreeView, QQuickTumbler, and QWaylandQuickItem.
Definition at line 4103 of file qquickitem.cpp.
This event handler can be reimplemented in a subclass to receive key release events for an item.
The event information is provided by the event parameter.
\input item.qdocinc accepting-events
Reimplemented in QQuickAbstractButton, QQuickComboBox, QQuickDial, QQuickFileDialogDelegate, QQuickMenuBar, QQuickMenuBarItem, QQuickPopupItem, QQuickRangeSlider, QQuickSlider, QQuickSpinBox, QQuickTextEdit, and QWaylandQuickItem.
Definition at line 4115 of file qquickitem.cpp.
QPointF QQuickItem::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.
\input item.qdocinc mapping
If item is \nullptr, this maps point from the coordinate system of the scene.
Definition at line 8901 of file qquickitem.cpp.
QRectF QQuickItem::mapFromItem | ( | const QQuickItem * | item, |
const QRectF & | rect ) const |
Definition at line 10102 of file qquickitem.cpp.
QPointF QQuickItem::mapFromItem | ( | const QQuickItem * | item, |
qreal | x, | ||
qreal | y ) |
Definition at line 10098 of file qquickitem.cpp.
QRectF QQuickItem::mapFromItem | ( | const QQuickItem * | item, |
qreal | x, | ||
qreal | y, | ||
qreal | width, | ||
qreal | height ) const |
Definition at line 10106 of file qquickitem.cpp.
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.
\input item.qdocinc mapping
Definition at line 8923 of file qquickitem.cpp.
QRectF QQuickItem::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.
\input item.qdocinc mapping
If item is \nullptr, this maps rect from the coordinate system of the scene.
Definition at line 8985 of file qquickitem.cpp.
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.
\input item.qdocinc mapping
Definition at line 9002 of file qquickitem.cpp.
QRectF QQuickItem::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.
\input item.qdocinc mapping
If item is \nullptr, this maps rect to the coordinate system of the scene.
Definition at line 8865 of file qquickitem.cpp.
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.
\input item.qdocinc mapping
Definition at line 8883 of file qquickitem.cpp.
QPointF QQuickItem::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.
\input item.qdocinc mapping
If item is \nullptr, this maps point to the coordinate system of the scene.
Definition at line 8794 of file qquickitem.cpp.
QRectF QQuickItem::mapToItem | ( | const QQuickItem * | item, |
const QRectF & | rect ) const |
Definition at line 10114 of file qquickitem.cpp.
QPointF QQuickItem::mapToItem | ( | const QQuickItem * | item, |
qreal | x, | ||
qreal | y ) |
Definition at line 10110 of file qquickitem.cpp.
QRectF QQuickItem::mapToItem | ( | const QQuickItem * | item, |
qreal | x, | ||
qreal | y, | ||
qreal | width, | ||
qreal | height ) const |
Definition at line 10118 of file qquickitem.cpp.
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.
\input item.qdocinc mapping
Definition at line 8817 of file qquickitem.cpp.
|
protectedvirtual |
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 in QQuickAbstractButton, QQuickMouseArea, QQuickPopupItem, QQuickTextArea, QQuickTextEdit, QQuickTextField, and QQuickTextInput.
Definition at line 4225 of file qquickitem.cpp.
|
protectedvirtual |
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 in QQuickControl, QQuickFlickable, QQuickMouseArea, QQuickMultiPointTouchArea, QQuickOverlay, QQuickPathView, QQuickPopupItem, QQuickSwipeDelegate, QQuickSwitch, QQuickSwitchDelegate, QQuickTextArea, QQuickTextEdit, QQuickTextField, QQuickTextInput, QWaylandMouseTracker, and QWaylandQuickItem.
Definition at line 4197 of file qquickitem.cpp.
|
protectedvirtual |
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 in QDeclarativeGeoMapCopyrightNotice, QQuickAbstractButton, QQuickControl, QQuickDial, QQuickFlickable, QQuickMouseArea, QQuickMultiPointTouchArea, QQuickOverlay, QQuickPathView, QQuickPopupItem, QQuickRangeSlider, QQuickScrollBar, QQuickSlider, QQuickSwipeDelegate, QQuickText, QQuickTextArea, QQuickTextEdit, QQuickTextField, QQuickTextInput, QQuickTreeViewDelegate, and QWaylandQuickItem.
Definition at line 4181 of file qquickitem.cpp.
|
protectedvirtual |
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 in QDeclarativeGeoMapCopyrightNotice, QQuickControl, QQuickFlickable, QQuickMouseArea, QQuickMultiPointTouchArea, QQuickOverlay, QQuickPathView, QQuickPopupItem, QQuickSwipeDelegate, QQuickText, QQuickTextArea, QQuickTextEdit, QQuickTextField, QQuickTextInput, and QWaylandQuickItem.
Definition at line 4213 of file qquickitem.cpp.
|
protectedvirtual |
This event handler can be reimplemented in a subclass to be notified when a mouse ungrab event has occurred on this item.
Reimplemented in QQuickControl, QQuickFlickable, QQuickMouseArea, QQuickMultiPointTouchArea, QQuickPathView, QQuickPopupItem, QQuickSwipeDelegate, and QQuickTextInput.
Definition at line 4234 of file qquickitem.cpp.
qreal QQuickItem::opacity | ( | ) | const |
Definition at line 6425 of file qquickitem.cpp.
|
signal |
|
signal |
QQuickItem * QQuickItem::parentItem | ( | ) | const |
Definition at line 2724 of file qquickitem.cpp.
void QQuickItem::polish | ( | ) |
Schedules a polish event for this item.
When the scene graph processes the request, it will call updatePolish() on this item.
Definition at line 4604 of file qquickitem.cpp.
QPointF QQuickItem::position | ( | ) | const |
Definition at line 7206 of file qquickitem.cpp.
QQuickItem::Q_REVISION | ( | 2 | , |
1 | ) |
|
signal |
|
signal |
|
signal |
QQuickItem::Q_REVISION | ( | 2 | , |
4 | ) const & |
QQuickItem::Q_REVISION | ( | 2 | , |
7 | ) const & |
QQuickItem::Q_REVISION | ( | 2 | , |
7 | ) |
QQuickItem::Q_REVISION | ( | 2 | , |
7 | ) const & |
QQuickItem::Q_REVISION | ( | 2 | , |
7 | ) |
|
signal |
|
signal |
QQuickItem::Q_REVISION | ( | 6 | , |
3 | ) const |
QQuickItem::Q_REVISION | ( | 6 | , |
3 | ) |
|
protectedvirtual |
This function is called when an item should release graphics resources which are not already managed by the nodes returned from QQuickItem::updatePaintNode().
This happens when the item is about to be removed from the window it was previously rendering to. The item is guaranteed to have a \l {QQuickItem::window()}{window} when the function is called.
The function is called on the GUI thread and the state of the rendering thread, when it is used, is unknown. Objects should not be deleted directly, but instead scheduled for cleanup using QQuickWindow::scheduleRenderJob().
Reimplemented in QQuick3DViewport, QQuickCanvasItem, QQuickFramebufferObject, QQuickImage, QQuickPaintedItem, QQuickRhiItem, QQuickShaderEffectSource, QQuickVideoOutput, and QQuickWindowContainer.
Definition at line 4002 of file qquickitem.cpp.
void QQuickItem::resetAntialiasing | ( | ) |
Definition at line 7073 of file qquickitem.cpp.
void QQuickItem::resetHeight | ( | ) |
Definition at line 7555 of file qquickitem.cpp.
void QQuickItem::resetWidth | ( | ) |
Definition at line 7347 of file qquickitem.cpp.
qreal QQuickItem::rotation | ( | ) | const |
Definition at line 6194 of file qquickitem.cpp.
|
signal |
qreal QQuickItem::scale | ( | ) | const |
Definition at line 6294 of file qquickitem.cpp.
|
signal |
QQuickItem * QQuickItem::scopedFocusItem | ( | ) | const |
If this item is a focus scope, this returns the item in its focus chain that currently has focus.
Returns \nullptr if this item is not a focus scope.
Definition at line 7981 of file qquickitem.cpp.
void QQuickItem::setAcceptedMouseButtons | ( | Qt::MouseButtons | buttons | ) |
Sets the mouse buttons accepted by this item to buttons.
Definition at line 8082 of file qquickitem.cpp.
void QQuickItem::setAcceptHoverEvents | ( | bool | enabled | ) |
If enabled is true, this sets the item to accept hover events; otherwise, hover events are not accepted by this item.
Definition at line 8165 of file qquickitem.cpp.
void QQuickItem::setAcceptTouchEvents | ( | bool | enabled | ) |
If enabled is true, this sets the item to accept touch events; otherwise, touch events are not accepted by this item.
Definition at line 8200 of file qquickitem.cpp.
void QQuickItem::setActiveFocusOnTab | ( | bool | activeFocusOnTab | ) |
Definition at line 7010 of file qquickitem.cpp.
void QQuickItem::setAntialiasing | ( | bool | aa | ) |
Definition at line 7053 of file qquickitem.cpp.
Definition at line 4554 of file qquickitem.cpp.
void QQuickItem::setClip | ( | bool | c | ) |
Definition at line 3860 of file qquickitem.cpp.
Definition at line 8742 of file qquickitem.cpp.
void QQuickItem::setEnabled | ( | bool | e | ) |
Definition at line 6584 of file qquickitem.cpp.
void QQuickItem::setFiltersChildMouseEvents | ( | bool | filter | ) |
Sets whether pointer events intended for this item's children should be filtered through this item.
If filter is true, childMouseEventFilter() will be called when a pointer event is triggered for a child item.
Definition at line 8120 of file qquickitem.cpp.
Enables the specified flag for this item if enabled is true; if enabled is false, the flag is disabled.
These provide various hints for the item; for example, the ItemClipsChildrenToShape flag indicates that all children of this item should be clipped to fit within the item area.
Definition at line 7113 of file qquickitem.cpp.
Enables the specified flags for this item.
Definition at line 7146 of file qquickitem.cpp.
void QQuickItem::setFocus | ( | bool | focus, |
Qt::FocusReason | reason ) |
Definition at line 7905 of file qquickitem.cpp.
void QQuickItem::setFocus | ( | bool | focus | ) |
Definition at line 7900 of file qquickitem.cpp.
void QQuickItem::setFocusPolicy | ( | Qt::FocusPolicy | policy | ) |
Sets the focus policy of this item to policy.
Definition at line 8025 of file qquickitem.cpp.
Definition at line 7530 of file qquickitem.cpp.
Definition at line 7589 of file qquickitem.cpp.
Definition at line 7623 of file qquickitem.cpp.
\qmlproperty real QtQuick::Item::implicitWidth \qmlproperty real QtQuick::Item::implicitHeight Defines the preferred width or height of the Item. If \l width or \l height is not specified, an item's effective size will be determined by its \l implicitWidth or \l implicitHeight. However, if an item is the child of a \l {Qt Quick Layouts}{layout}, the layout will determine the item's preferred size using its implicit size. In such a scenario, the explicit \l width or \l height will be ignored. The default implicit size for most items is 0x0, however some items have an inherent implicit size which cannot be overridden, for example, \l [QML] Image and \l [QML] Text. Setting the implicit size is useful for defining components that have a preferred size based on their content, for example: \qml
Label.qml import QtQuick 2.0
Item { property alias icon: image.source property alias label: text.text implicitWidth: text.implicitWidth + image.implicitWidth implicitHeight: Math.max(text.implicitHeight, image.implicitHeight) Image { id: image } Text { id: text wrapMode: Text.Wrap anchors.left: image.right; anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter } } \endqml
\property QQuickItem::implicitWidth \property QQuickItem::implicitHeight Defines the preferred width or height of the Item. If \l width or \l height is not specified, an item's effective size will be determined by its \l implicitWidth or \l implicitHeight. However, if an item is the child of a \l {Qt Quick Layouts}{layout}, the layout will determine the item's preferred size using its implicit size. In such a scenario, the explicit \l width or \l height will be ignored. The default implicit size for most items is 0x0, however some items have an inherent implicit size which cannot be overridden, for example, \l [QML] Image and \l [QML] Text. Setting the implicit size is useful for defining components that have a preferred size based on their content, for example: \qml
Label.qml import QtQuick 2.0
Item { property alias icon: image.source property alias label: text.text implicitWidth: text.implicitWidth + image.implicitWidth implicitHeight: Math.max(text.implicitHeight, image.implicitHeight) Image { id: image } Text { id: text wrapMode: Text.Wrap anchors.left: image.right; anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter } } \endqml
Definition at line 7462 of file qquickitem.cpp.
void QQuickItem::setKeepMouseGrab | ( | bool | keep | ) |
Sets whether the mouse input should remain exclusively with this item.
This is useful for items that wish to grab and keep mouse interaction following a predefined gesture. For example, an item that is interested in horizontal mouse movement may set keepMouseGrab to true once a threshold has been exceeded. Once keepMouseGrab has been set to true, filtering items will not react to mouse events.
If keep is false, a filtering item may steal the grab. For example, \l Flickable may attempt to steal a mouse grab if it detects that the user has begun to move the viewport.
Definition at line 8554 of file qquickitem.cpp.
void QQuickItem::setKeepTouchGrab | ( | bool | keep | ) |
Sets whether the touch points grabbed by this item should remain exclusively with this item.
This is useful for items that wish to grab and keep specific touch points following a predefined gesture. For example, an item that is interested in horizontal touch point movement may set setKeepTouchGrab to true once a threshold has been exceeded. Once setKeepTouchGrab has been set to true, filtering items will not react to the relevant touch points.
If keep is false, a filtering item may steal the grab. For example, \l Flickable may attempt to steal a touch point grab if it detects that the user has begun to move the viewport.
Definition at line 8625 of file qquickitem.cpp.
Definition at line 6431 of file qquickitem.cpp.
void QQuickItem::setParentItem | ( | QQuickItem * | parent | ) |
Definition at line 2730 of file qquickitem.cpp.
Definition at line 7268 of file qquickitem.cpp.
Definition at line 6200 of file qquickitem.cpp.
Definition at line 6300 of file qquickitem.cpp.
Sets the size of the item to size. This methods preserves any existing binding on width and height; thus any change that triggers the binding to execute again will override the set values.
Definition at line 7709 of file qquickitem.cpp.
void QQuickItem::setSmooth | ( | bool | smooth | ) |
Definition at line 6954 of file qquickitem.cpp.
Definition at line 5300 of file qquickitem.cpp.
void QQuickItem::setTransformOrigin | ( | TransformOrigin | origin | ) |
Definition at line 5920 of file qquickitem.cpp.
Definition at line 5950 of file qquickitem.cpp.
void QQuickItem::setVisible | ( | bool | v | ) |
Definition at line 6531 of file qquickitem.cpp.
Definition at line 7325 of file qquickitem.cpp.
Definition at line 7212 of file qquickitem.cpp.
Definition at line 7242 of file qquickitem.cpp.
Definition at line 6120 of file qquickitem.cpp.
QSizeF QQuickItem::size | ( | ) | const |
bool QQuickItem::smooth | ( | ) | const |
Definition at line 6949 of file qquickitem.cpp.
|
signal |
void QQuickItem::stackAfter | ( | const QQuickItem * | sibling | ) |
Moves the specified sibling item to the index after this item within the list of children.
The order of children affects both the visual stacking order and tab focus navigation order.
Assuming the z values of both items are the same, this will cause sibling to be rendered below this item.
If both items have activeFocusOnTab set to true
, this will also cause the tab focus order to change, with sibling receiving focus before this item.
The given sibling must be a sibling of this item; that is, they must have the same immediate \l parent.
Definition at line 2935 of file qquickitem.cpp.
void QQuickItem::stackBefore | ( | const QQuickItem * | sibling | ) |
Moves the specified sibling item to the index before this item within the list of children.
The order of children affects both the visual stacking order and tab focus navigation order.
Assuming the z values of both items are the same, this will cause sibling to be rendered above this item.
If both items have activeFocusOnTab set to true
, this will also cause the tab focus order to change, with sibling receiving focus after this item.
The given sibling must be a sibling of this item; that is, they must have the same immediate \l parent.
Definition at line 2890 of file qquickitem.cpp.
QString QQuickItem::state | ( | ) | const |
\qmlproperty string QtQuick::Item::state
This property holds the name of the current state of the item.
If the item is in its default state, that is, no explicit state has been set, then this property holds an empty string. Likewise, you can return an item to its default state by setting this property to an empty string.
This property holds the name of the current state of the item.
If the item is in its default state, that is, no explicit state has been set, then this property holds an empty string. Likewise, you can return an item to its default state by setting this property to an empty string.
Definition at line 5294 of file qquickitem.cpp.
|
virtual |
Returns the texture provider for an item.
The default implementation returns \nullptr.
This function may only be called on the rendering thread.
Reimplemented in QQuick3DViewport, QQuickCanvasItem, QQuickFramebufferObject, QQuickImage, QQuickPaintedItem, QQuickRhiItem, QQuickShaderEffectSource, and QWaylandQuickItem.
Definition at line 9241 of file qquickitem.cpp.
|
protectedvirtual |
This event handler can be reimplemented in a subclass to receive touch events for an item.
The event information is provided by the event parameter.
\input item.qdocinc accepting-events
Reimplemented in QQuickFlickable, QQuickMultiPointTouchArea, QQuickPinchArea, QQuickSwipeDelegate, and QWaylandQuickItem.
Definition at line 4269 of file qquickitem.cpp.
|
protectedvirtual |
This event handler can be reimplemented in a subclass to be notified when a touch ungrab event has occurred on this item.
Reimplemented in QQuickMouseArea, QQuickMultiPointTouchArea, and QWaylandQuickItem.
Definition at line 4243 of file qquickitem.cpp.
QQmlListProperty< QQuickTransform > QQuickItem::transform | ( | ) |
QQuickItem::TransformOrigin QQuickItem::transformOrigin | ( | ) | const |
Definition at line 5914 of file qquickitem.cpp.
|
signal |
QPointF QQuickItem::transformOriginPoint | ( | ) | const |
Definition at line 5939 of file qquickitem.cpp.
void QQuickItem::ungrabMouse | ( | ) |
Releases the mouse grab following a call to grabMouse().
Note that this function should only be called when the item wants to stop handling further events. There is no need to call this function after a release or cancel event since no future events will be received in any case. No move or release events will be delivered after this function was called.
Releases the mouse grab following a call to grabMouse().
Note that this function should only be called when the item wants to stop handling further events. There is no need to call this function after a release or cancel event since no future events will be received in any case. No move or release events will be delivered after this function was called.
Definition at line 8509 of file qquickitem.cpp.
void QQuickItem::ungrabTouchPoints | ( | ) |
Definition at line 8587 of file qquickitem.cpp.
|
slot |
Schedules a call to updatePaintNode() for this item.
The call to QQuickItem::updatePaintNode() will always happen if the item is showing in a QQuickWindow.
Only items which specify QQuickItem::ItemHasContents are allowed to call QQuickItem::update().
Definition at line 4584 of file qquickitem.cpp.
|
protectedvirtual |
Called on the render thread when it is time to sync the state of the item with the scene graph.
The function is called as a result of QQuickItem::update(), if the user has set the QQuickItem::ItemHasContents flag on the item.
The function should return the root of the scene graph subtree for this item. Most implementations will return a single QSGGeometryNode containing the visual representation of this item. oldNode is the node that was returned the last time the function was called. updatePaintNodeData provides a pointer to the QSGTransformNode associated with this QQuickItem.
The main thread is blocked while this function is executed so it is safe to read values from the QQuickItem instance and other objects in the main thread.
If no call to QQuickItem::updatePaintNode() result in actual scene graph changes, like QSGNode::markDirty() or adding and removing nodes, then the underlying implementation may decide to not render the scene again as the visual outcome is identical.
Reimplemented in QDeclarativeGeoMap, QDeclarativeGeoMapItemBase, QQuick3DViewport, QQuickAnimatedSprite, QQuickBasicBusyIndicator, QQuickBasicProgressBar, QQuickBorderImage, QQuickCanvasItem, QQuickFramebufferObject, QQuickImage, QQuickImageParticle, QQuickItemParticle, QQuickMaterialBusyIndicator, QQuickMaterialProgressBar, QQuickMaterialRipple, QQuickMouseArea, QQuickMultiPointTouchArea, QQuickNinePatchImage, QQuickPaddedRectangle, QQuickPaintedItem, QQuickRectangle, QQuickRhiItem, QQuickShaderEffect, QQuickShaderEffectSource, QQuickShape, QQuickSpriteSequence, QQuickStyleItem, QQuickText, QQuickTextArea, QQuickTextEdit, QQuickTextField, QQuickTextInput, QQuickUniversalBusyIndicator, QQuickUniversalProgressBar, QQuickVideoOutput, and QWaylandQuickItem.
Definition at line 3973 of file qquickitem.cpp.
|
protectedvirtual |
This function should perform any layout as required for this item.
When polish() is called, the scene graph schedules a polish event for this item. When the scene graph is ready to render this item, it calls updatePolish() to do any item layout as required before it renders the next frame.
Reimplemented in QDeclarativeCircleMapItem, QDeclarativeGeoMapQuickItem, QDeclarativePolygonMapItem, QDeclarativePolylineMapItem, QDeclarativeRectangleMapItem, QGfxSourceProxyME, QQuickBasePositioner, QQuickCanvasItem, QQuickDialogButtonBox, QQuickFlipable, QQuickItemView, QQuickLayout, QQuickMonthGrid, QQuickPathView, QQuickPopupItem, QQuickShape, QQuickStyleItem, QQuickTabBar, QQuickText, QQuickTextEdit, QQuickTextInput, QQuickTumbler, and QQuickWindowContainer.
Definition at line 4021 of file qquickitem.cpp.
QQuickItem * QQuickItem::viewportItem | ( | ) | const |
If the \l ItemObservesViewport flag is set, returns the nearest parent with the \l ItemIsViewport flag.
Returns the window's contentItem if the flag is not set, or if no other viewport item is found.
Returns \nullptr only if there is no viewport item and this item is not shown in a window.
Definition at line 5871 of file qquickitem.cpp.
|
signal |
|
signal |
qreal QQuickItem::width | ( | ) | const |
Definition at line 7319 of file qquickitem.cpp.
|
signal |
|
protected |
Returns whether the width property has been set explicitly.
Definition at line 7496 of file qquickitem.cpp.
QQuickWindow * QQuickItem::window | ( | ) | const |
Returns the window in which this item is rendered.
The item does not have a window until it has been assigned into a scene. The \l windowChanged() signal provides a notification both when the item is entered into a scene and when it is removed from a scene.
Definition at line 2974 of file qquickitem.cpp.
qreal QQuickItem::x | ( | ) | const |
Definition at line 7191 of file qquickitem.cpp.
|
signal |
qreal QQuickItem::y | ( | ) | const |
Definition at line 7197 of file qquickitem.cpp.
|
signal |
qreal QQuickItem::z | ( | ) | const |
Definition at line 6114 of file qquickitem.cpp.
|
signal |
|
friend |
|
friend |
Definition at line 480 of file qquickitem.h.
|
friend |
Definition at line 481 of file qquickitem.h.
|
friend |
Definition at line 482 of file qquickitem.h.
|
friend |
Definition at line 478 of file qquickitem.h.
|
friend |
Definition at line 479 of file qquickitem.h.
Definition at line 349 of file qquickitem.h.
Definition at line 308 of file qquickitem.h.
|
readwrite |
\qmlproperty bool QtQuick::Item::antialiasing
Used by visual elements to decide if the item should use antialiasing or not. In some cases items with antialiasing require more memory and are potentially slower to render (see \l {Antialiasing} for more details).
The default is false, but may be overridden by derived elements.
Specifies whether the item is antialiased or not
Used by visual elements to decide if the item should use antialiasing or not. In some cases items with antialiasing require more memory and are potentially slower to render (see \l {Antialiasing} for more details).
The default is false, but may be overridden by derived elements.
Definition at line 113 of file qquickitem.h.
|
readwrite |
\qmlproperty QObject* QtQuick::Item::containmentMask
By default the contains()
method will return true for any point within the Item's bounding box. containmentMask
allows for more fine-grained control. For example, if a custom C++ QQuickItem subclass with a specialized contains() method is used as containmentMask:
{item}'s contains method would then return true
only if {anotherItem}'s contains() implementation returns true
.
A \l Shape can be used as a mask, to make an item react to \l {QPointerEvent}{pointer events} only within a non-rectangular region:
\table \row
It is also possible to define the contains method in QML. For example, to create a circular item that only responds to events within its actual bounds:
\table \row
By default, \l contains() will return true
for any point within the Item's bounding box. But any QQuickItem, or any QObject that implements a function of the form
can be used as a mask, to defer hit-testing to that object.
Definition at line 116 of file qquickitem.h.
|
readwrite |
\qmlproperty bool QtQuick::Item::enabled
This property holds whether the item receives mouse and keyboard events. By default this is true.
Setting this property directly affects the enabled
value of child items. When set to false
, the enabled
values of all child items also become false
. When set to true
, the enabled
values of child items are returned to true
, unless they have explicitly been set to false
.
Setting this property to false
automatically causes \l activeFocus to be set to false
, and this item will no longer receive keyboard events.
This property holds whether the item receives mouse and keyboard events. By default this is true.
Setting this property directly affects the enabled
value of child items. When set to false
, the enabled
values of all child items also become false
. When set to true
, the enabled
values of child items are returned to true
, unless they have explicitly been set to false
.
Setting this property to false
automatically causes \l activeFocus to be set to false
, and this item will longer receive keyboard events.
false
. This makes it possible to show informational feedback (such as \l ToolTip) even when an interactive item is disabled. The same is also true for any \l {HoverHandler}{HoverHandlers} added as children of the item. A HoverHandler can, however, be \l {PointerHandler::enabled}{disabled} explicitly, or for example be bound to the enabled
state of the item.Definition at line 79 of file qquickitem.h.
|
readwrite |
\qmlproperty enumeration QtQuick::Item::focusPolicy
This property determines the way the item accepts focus.
\value Qt.TabFocus The item accepts focus by tabbing. \value Qt.ClickFocus The item accepts focus by clicking. \value Qt.StrongFocus The item accepts focus by both tabbing and clicking. \value Qt.WheelFocus The item accepts focus by tabbing, clicking, and using the mouse wheel. \value Qt.NoFocus The item does not accept focus.
This property determines the way the item accepts focus.
Definition at line 104 of file qquickitem.h.
|
readwrite |
This property holds the height of this item.
Definition at line 76 of file qquickitem.h.
|
readwrite |
Definition at line 115 of file qquickitem.h.
|
readwrite |
Definition at line 114 of file qquickitem.h.
|
readwrite |
\qmlproperty real QtQuick::Item::opacity
This property holds the opacity of the item. Opacity is specified as a number between 0.0 (fully transparent) and 1.0 (fully opaque). The default value is 1.0.
When this property is set, the specified opacity is also applied individually to child items. This may have an unintended effect in some circumstances. For example in the second set of rectangles below, the red rectangle has specified an opacity of 0.5, which affects the opacity of its blue child rectangle even though the child has not specified an opacity.
\table \row
Changing an item's opacity does not affect whether the item receives user input events. (In contrast, setting \l visible property to false
stops mouse events, and setting the \l enabled property to false
stops mouse and keyboard events, and also removes active focus from the item.)
This property holds the opacity of the item. Opacity is specified as a number between 0.0 (fully transparent) and 1.0 (fully opaque). The default value is 1.0.
When this property is set, the specified opacity is also applied individually to child items. This may have an unintended effect in some circumstances. For example in the second set of rectangles below, the red rectangle has specified an opacity of 0.5, which affects the opacity of its blue child rectangle even though the child has not specified an opacity.
Values outside the range of 0 to 1 will be clamped.
\table \row
Changing an item's opacity does not affect whether the item receives user input events. (In contrast, setting \l visible property to false
stops mouse events, and setting the \l enabled property to false
stops mouse and keyboard events, and also removes active focus from the item.)
Definition at line 78 of file qquickitem.h.
|
readwrite |
\qmlproperty Item QtQuick::Item::parent This property holds the visual parent of the item.
This property holds the visual parent of the item.
Definition at line 67 of file qquickitem.h.
|
readwrite |
\qmlproperty real QtQuick::Item::rotation This property holds the rotation of the item in degrees clockwise around its transformOrigin.
The default value is 0 degrees (that is, no rotation).
\table \row
This property holds the rotation of the item in degrees clockwise around its transformOrigin.
The default value is 0 degrees (that is, no rotation).
\table \row
Definition at line 106 of file qquickitem.h.
|
readwrite |
\qmlproperty real QtQuick::Item::scale This property holds the scale factor for this item.
A scale of less than 1.0 causes the item to be rendered at a smaller size, and a scale greater than 1.0 renders the item at a larger size. A negative scale causes the item to be mirrored when rendered.
The default value is 1.0.
Scaling is applied from the transformOrigin.
\table \row
Rectangle { color: "blue" width: 100; height: 100
Rectangle { color: "green" width: 25; height: 25 }
Rectangle { color: "red" x: 25; y: 25; width: 50; height: 50 scale: 1.4 transformOrigin: Item.TopLeft } } \endqml \endtable
This property holds the scale factor for this item.
A scale of less than 1.0 causes the item to be rendered at a smaller size, and a scale greater than 1.0 renders the item at a larger size. A negative scale causes the item to be mirrored when rendered.
The default value is 1.0.
Scaling is applied from the transformOrigin.
\table \row
Rectangle { color: "blue" width: 100; height: 100
Rectangle { color: "green" width: 25; height: 25 }
Rectangle { color: "red" x: 25; y: 25; width: 50; height: 50 scale: 1.4 } } \endqml \endtable
Definition at line 107 of file qquickitem.h.
|
readwrite |
\qmlproperty bool QtQuick::Item::smooth
Primarily used in image based items to decide if the item should use smooth sampling or not. Smooth sampling is performed using linear interpolation, while non-smooth is performed using nearest neighbor.
In Qt Quick 2.0, this property has minimal impact on performance.
By default, this property is set to true
.
Specifies whether the item is smoothed or not
Primarily used in image based items to decide if the item should use smooth sampling or not. Smooth sampling is performed using linear interpolation, while non-smooth is performed using nearest neighbor.
In Qt Quick 2.0, this property has minimal impact on performance.
By default, this property is set to true
.
Definition at line 112 of file qquickitem.h.
|
read |
\qmlproperty list<Transform> QtQuick::Item::transform This property holds the list of transformations to apply.
For more information see \l Transform.
Definition at line 110 of file qquickitem.h.
|
readwrite |
\qmlproperty enumeration QtQuick::Item::transformOrigin This property holds the origin point around which scale and rotation transform.
Nine transform origins are available, as shown in the image below. The default transform origin is Item.Center
.
This example rotates an image around its bottom-right corner. \qml Image { source: "myimage.png" transformOrigin: Item.BottomRight rotation: 45 } \endqml
To set an arbitrary transform origin point use the \l Scale or \l Rotation transform types with \l transform.
This property holds the origin point around which scale and rotation transform.
Nine transform origins are available, as shown in the image below. The default transform origin is Item.Center
.
Definition at line 108 of file qquickitem.h.
|
read |
Definition at line 109 of file qquickitem.h.
|
readwrite |
\qmlproperty bool QtQuick::Item::visible
This property holds whether the item is visible. By default this is true.
Setting this property directly affects the visible
value of child items. When set to false
, the visible
values of all child items also become false
. When set to true
, the visible
values of child items are returned to true
, unless they have explicitly been set to false
.
(Because of this flow-on behavior, using the visible
property may not have the intended effect if a property binding should only respond to explicit property changes. In such cases it may be better to use the \l opacity property instead.)
If this property is set to false
, the item will no longer receive mouse events, but will continue to receive key events and will retain the keyboard \l focus if it has been set. (In contrast, setting the \l enabled property to false
stops both mouse and keyboard events, and also removes focus from the item.)
visible
property. It does not change, for example, if this item moves off-screen, or if the \l opacity changes to 0.This property holds whether the item is visible. By default this is true.
Setting this property directly affects the visible
value of child items. When set to false
, the visible
values of all child items also become false
. When set to true
, the visible
values of child items are returned to true
, unless they have explicitly been set to false
.
(Because of this flow-on behavior, using the visible
property may not have the intended effect if a property binding should only respond to explicit property changes. In such cases it may be better to use the \l opacity property instead.)
If this property is set to false
, the item will no longer receive mouse events, but will continue to receive key events and will retain the keyboard \l focus if it has been set. (In contrast, setting the \l enabled property to false
stops both mouse and keyboard events, and also removes focus from the item.)
visible
property. It does not change, for example, if this item moves off-screen, or if the \l opacity changes to 0. However, for historical reasons, this property is true after the item's construction, even if the item hasn't been added to a scene yet. Changing or reading this property of an item that has not been added to a scene might not produce the expected results.Definition at line 80 of file qquickitem.h.
|
readwrite |
This property holds the width of this item.
Definition at line 75 of file qquickitem.h.
|
readwrite |
\qmlproperty real QtQuick::Item::x \qmlproperty real QtQuick::Item::y \qmlproperty real QtQuick::Item::width \qmlproperty real QtQuick::Item::height
Defines the item's position and size. The default value is 0
.
The (x,y) position is relative to the \l parent.
\qml Item { x: 100; y: 100; width: 100; height: 100 } \endqml
Defines the item's x position relative to its parent.
Definition at line 72 of file qquickitem.h.
|
readwrite |
Defines the item's y position relative to its parent.
Definition at line 73 of file qquickitem.h.
|
readwrite |
\qmlproperty real QtQuick::Item::z
Sets the stacking order of sibling items. By default the stacking order is 0.
Items with a higher stacking value are drawn on top of siblings with a lower stacking order. Items with the same stacking value are drawn bottom up in the order they appear. Items with a negative stacking value are drawn under their parent's content.
The following example shows the various effects of stacking order.
\table \row
z
- later children above earlier children: \qml Item { Rectangle { color: "red" width: 100; height: 100 } Rectangle { color: "blue" x: 50; y: 50; width: 100; height: 100 } } \endqml \row z
on top: \qml Item { Rectangle { z: 1 color: "red" width: 100; height: 100 } Rectangle { color: "blue" x: 50; y: 50; width: 100; height: 100 } } \endqml \row z
- children above parents: \qml Item { Rectangle { color: "red" width: 100; height: 100 Rectangle { color: "blue" x: 50; y: 50; width: 100; height: 100 } } } \endqml \row z
below: \qml Item { Rectangle { color: "red" width: 100; height: 100 Rectangle { z: -1 color: "blue" x: 50; y: 50; width: 100; height: 100 } } } \endqml \endtableSets the stacking order of sibling items. By default the stacking order is 0.
Items with a higher stacking value are drawn on top of siblings with a lower stacking order. Items with the same stacking value are drawn bottom up in the order they appear. Items with a negative stacking value are drawn under their parent's content.
The following example shows the various effects of stacking order.
\table \row
z
- later children above earlier children: \qml Item { Rectangle { color: "red" width: 100; height: 100 } Rectangle { color: "blue" x: 50; y: 50; width: 100; height: 100 } } \endqml \row z
on top: \qml Item { Rectangle { z: 1 color: "red" width: 100; height: 100 } Rectangle { color: "blue" x: 50; y: 50; width: 100; height: 100 } } \endqml \row z
- children above parents: \qml Item { Rectangle { color: "red" width: 100; height: 100 Rectangle { color: "blue" x: 50; y: 50; width: 100; height: 100 } } } \endqml \row z
below: \qml Item { Rectangle { color: "red" width: 100; height: 100 Rectangle { z: -1 color: "blue" x: 50; y: 50; width: 100; height: 100 } } } \endqml \endtable Definition at line 74 of file qquickitem.h.