| 1 | // Copyright (C) 2020 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QQUICKITEM_H |
| 5 | #define QQUICKITEM_H |
| 6 | |
| 7 | #include <QtQuick/qtquickglobal.h> |
| 8 | #include <QtQml/qqml.h> |
| 9 | #include <QtQml/qqmlcomponent.h> |
| 10 | |
| 11 | #include <QtCore/QObject> |
| 12 | #include <QtCore/QList> |
| 13 | #include <QtCore/qproperty.h> |
| 14 | #include <QtGui/qevent.h> |
| 15 | #include <QtGui/qfont.h> |
| 16 | #include <QtGui/qaccessible.h> |
| 17 | |
| 18 | QT_BEGIN_NAMESPACE |
| 19 | |
| 20 | class QQuickItem; |
| 21 | class QQuickTransformPrivate; |
| 22 | class Q_QUICK_EXPORT QQuickTransform : public QObject |
| 23 | { |
| 24 | Q_OBJECT |
| 25 | QML_ANONYMOUS |
| 26 | QML_ADDED_IN_VERSION(2, 0) |
| 27 | public: |
| 28 | explicit QQuickTransform(QObject *parent = nullptr); |
| 29 | ~QQuickTransform() override; |
| 30 | |
| 31 | void appendToItem(QQuickItem *); |
| 32 | void prependToItem(QQuickItem *); |
| 33 | |
| 34 | virtual void applyTo(QMatrix4x4 *matrix) const = 0; |
| 35 | |
| 36 | protected Q_SLOTS: |
| 37 | void update(); |
| 38 | |
| 39 | protected: |
| 40 | QQuickTransform(QQuickTransformPrivate &dd, QObject *parent); |
| 41 | |
| 42 | private: |
| 43 | Q_DECLARE_PRIVATE(QQuickTransform) |
| 44 | }; |
| 45 | |
| 46 | class QCursor; |
| 47 | class QQuickItemLayer; |
| 48 | class QQuickState; |
| 49 | class QQuickAnchorLine; |
| 50 | class QQuickTransition; |
| 51 | class QQuickKeyEvent; |
| 52 | class QQuickAnchors; |
| 53 | class QQuickItemPrivate; |
| 54 | class QQuickWindow; |
| 55 | class QTouchEvent; |
| 56 | class QSGNode; |
| 57 | class QSGTransformNode; |
| 58 | class QSGTextureProvider; |
| 59 | class QQuickItemGrabResult; |
| 60 | class QQuickPalette; |
| 61 | |
| 62 | class Q_QUICK_EXPORT QQuickItem : public QObject, public QQmlParserStatus |
| 63 | { |
| 64 | Q_OBJECT |
| 65 | Q_INTERFACES(QQmlParserStatus) |
| 66 | |
| 67 | Q_PROPERTY(QQuickItem *parent READ parentItem WRITE setParentItem NOTIFY parentChanged DESIGNABLE false FINAL) |
| 68 | Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQmlListProperty<QObject> data READ data DESIGNABLE false) |
| 69 | Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQmlListProperty<QObject> resources READ resources DESIGNABLE false) |
| 70 | Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQmlListProperty<QQuickItem> children READ children NOTIFY childrenChanged DESIGNABLE false) |
| 71 | |
| 72 | Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged BINDABLE bindableX FINAL) |
| 73 | Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged BINDABLE bindableY FINAL) |
| 74 | Q_PROPERTY(qreal z READ z WRITE setZ NOTIFY zChanged FINAL) |
| 75 | Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged RESET resetWidth BINDABLE bindableWidth FINAL) |
| 76 | Q_PROPERTY(qreal height READ height WRITE setHeight NOTIFY heightChanged RESET resetHeight BINDABLE bindableHeight FINAL) |
| 77 | |
| 78 | Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged FINAL) |
| 79 | Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) |
| 80 | Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL) |
| 81 | Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQuickPalette *palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged REVISION(6, 0)) |
| 82 | Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQmlListProperty<QQuickItem> visibleChildren READ visibleChildren NOTIFY visibleChildrenChanged DESIGNABLE false) |
| 83 | |
| 84 | Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQmlListProperty<QQuickState> states READ states DESIGNABLE false) |
| 85 | Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQmlListProperty<QQuickTransition> transitions READ transitions DESIGNABLE false) |
| 86 | Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged) |
| 87 | Q_PROPERTY(QRectF childrenRect READ childrenRect NOTIFY childrenRectChanged DESIGNABLE false FINAL) |
| 88 | Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQuickAnchors * anchors READ anchors DESIGNABLE false CONSTANT FINAL) |
| 89 | Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQuickAnchorLine left READ left CONSTANT FINAL) |
| 90 | Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQuickAnchorLine right READ right CONSTANT FINAL) |
| 91 | Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQuickAnchorLine horizontalCenter READ horizontalCenter CONSTANT FINAL) |
| 92 | Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQuickAnchorLine top READ top CONSTANT FINAL) |
| 93 | Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQuickAnchorLine bottom READ bottom CONSTANT FINAL) |
| 94 | Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQuickAnchorLine verticalCenter READ verticalCenter CONSTANT FINAL) |
| 95 | Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQuickAnchorLine baseline READ baseline CONSTANT FINAL) |
| 96 | Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged) |
| 97 | |
| 98 | Q_PROPERTY(bool clip READ clip WRITE setClip NOTIFY clipChanged) |
| 99 | |
| 100 | Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged FINAL) |
| 101 | Q_PROPERTY(bool activeFocus READ hasActiveFocus NOTIFY activeFocusChanged FINAL) |
| 102 | Q_PROPERTY(bool activeFocusOnTab READ activeFocusOnTab WRITE setActiveFocusOnTab NOTIFY activeFocusOnTabChanged FINAL REVISION(2, 1)) |
| 103 | |
| 104 | Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy NOTIFY focusPolicyChanged REVISION(6, 7)) |
| 105 | |
| 106 | Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) |
| 107 | Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) |
| 108 | Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin NOTIFY transformOriginChanged) |
| 109 | Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint) // deprecated - see QTBUG-26423 |
| 110 | Q_PROPERTY(QQmlListProperty<QQuickTransform> transform READ transform DESIGNABLE false FINAL) |
| 111 | |
| 112 | Q_PROPERTY(bool smooth READ smooth WRITE setSmooth NOTIFY smoothChanged) |
| 113 | Q_PROPERTY(bool antialiasing READ antialiasing WRITE setAntialiasing NOTIFY antialiasingChanged RESET resetAntialiasing) |
| 114 | Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged) |
| 115 | Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged) |
| 116 | Q_PROPERTY(QObject *containmentMask READ containmentMask WRITE setContainmentMask NOTIFY containmentMaskChanged REVISION(2, 11)) |
| 117 | |
| 118 | #if QT_CONFIG(quick_shadereffect) |
| 119 | Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQuickItemLayer *layer READ layer DESIGNABLE false CONSTANT FINAL) |
| 120 | #endif |
| 121 | |
| 122 | Q_CLASSINFO("DefaultProperty" , "data" ) |
| 123 | Q_CLASSINFO("ParentProperty" , "parent" ) |
| 124 | Q_CLASSINFO("qt_QmlJSWrapperFactoryMethod" , "_q_createJSWrapper(QQmlV4ExecutionEnginePtr)" ) |
| 125 | QML_NAMED_ELEMENT(Item) |
| 126 | QML_ADDED_IN_VERSION(2, 0) |
| 127 | |
| 128 | public: |
| 129 | enum Flag { |
| 130 | ItemClipsChildrenToShape = 0x01, |
| 131 | #if QT_CONFIG(im) |
| 132 | ItemAcceptsInputMethod = 0x02, |
| 133 | #endif |
| 134 | ItemIsFocusScope = 0x04, |
| 135 | ItemHasContents = 0x08, |
| 136 | ItemAcceptsDrops = 0x10, |
| 137 | ItemIsViewport = 0x20, |
| 138 | ItemObservesViewport = 0x40, |
| 139 | // Remember to increment the size of QQuickItemPrivate::flags |
| 140 | }; |
| 141 | Q_DECLARE_FLAGS(Flags, Flag) |
| 142 | Q_FLAG(Flags) |
| 143 | |
| 144 | enum ItemChange { |
| 145 | ItemChildAddedChange, // value.item |
| 146 | ItemChildRemovedChange, // value.item |
| 147 | ItemSceneChange, // value.window |
| 148 | ItemVisibleHasChanged, // value.boolValue |
| 149 | ItemParentHasChanged, // value.item |
| 150 | ItemOpacityHasChanged, // value.realValue |
| 151 | ItemActiveFocusHasChanged, // value.boolValue |
| 152 | ItemRotationHasChanged, // value.realValue |
| 153 | ItemAntialiasingHasChanged, // value.boolValue |
| 154 | ItemDevicePixelRatioHasChanged, // value.realValue |
| 155 | ItemEnabledHasChanged, // value.boolValue |
| 156 | ItemScaleHasChanged, // value.realValue |
| 157 | ItemTransformHasChanged, // value.item |
| 158 | }; |
| 159 | Q_ENUM(ItemChange) |
| 160 | |
| 161 | union ItemChangeData { |
| 162 | ItemChangeData(QQuickItem *v) : item(v) {} |
| 163 | ItemChangeData(QQuickWindow *v) : window(v) {} |
| 164 | ItemChangeData(qreal v) : realValue(v) {} |
| 165 | ItemChangeData(bool v) : boolValue(v) {} |
| 166 | |
| 167 | QQuickItem *item; |
| 168 | QQuickWindow *window; |
| 169 | qreal realValue; |
| 170 | bool boolValue; |
| 171 | }; |
| 172 | |
| 173 | enum TransformOrigin { |
| 174 | TopLeft, Top, TopRight, |
| 175 | Left, Center, Right, |
| 176 | BottomLeft, Bottom, BottomRight |
| 177 | }; |
| 178 | Q_ENUM(TransformOrigin) |
| 179 | |
| 180 | explicit QQuickItem(QQuickItem *parent = nullptr); |
| 181 | ~QQuickItem() override; |
| 182 | |
| 183 | QQuickWindow *window() const; |
| 184 | QQuickItem *parentItem() const; |
| 185 | void setParentItem(QQuickItem *parent); |
| 186 | void stackBefore(const QQuickItem *); |
| 187 | void stackAfter(const QQuickItem *); |
| 188 | |
| 189 | QRectF childrenRect(); |
| 190 | QList<QQuickItem *> childItems() const; |
| 191 | |
| 192 | bool clip() const; |
| 193 | void setClip(bool); |
| 194 | |
| 195 | QString state() const; |
| 196 | void setState(const QString &); |
| 197 | |
| 198 | qreal baselineOffset() const; |
| 199 | void setBaselineOffset(qreal); |
| 200 | |
| 201 | QQmlListProperty<QQuickTransform> transform(); |
| 202 | |
| 203 | qreal x() const; |
| 204 | qreal y() const; |
| 205 | QPointF position() const; |
| 206 | void setX(qreal); |
| 207 | void setY(qreal); |
| 208 | void setPosition(const QPointF &); |
| 209 | QBindable<qreal> bindableX(); |
| 210 | QBindable<qreal> bindableY(); |
| 211 | |
| 212 | qreal width() const; |
| 213 | void setWidth(qreal); |
| 214 | void resetWidth(); |
| 215 | void setImplicitWidth(qreal); |
| 216 | qreal implicitWidth() const; |
| 217 | QBindable<qreal> bindableWidth(); |
| 218 | |
| 219 | qreal height() const; |
| 220 | void setHeight(qreal); |
| 221 | void resetHeight(); |
| 222 | void setImplicitHeight(qreal); |
| 223 | qreal implicitHeight() const; |
| 224 | QBindable<qreal> bindableHeight(); |
| 225 | |
| 226 | QSizeF size() const; |
| 227 | void setSize(const QSizeF &size); |
| 228 | |
| 229 | TransformOrigin transformOrigin() const; |
| 230 | void setTransformOrigin(TransformOrigin); |
| 231 | QPointF transformOriginPoint() const; |
| 232 | void setTransformOriginPoint(const QPointF &); |
| 233 | |
| 234 | qreal z() const; |
| 235 | void setZ(qreal); |
| 236 | |
| 237 | qreal rotation() const; |
| 238 | void setRotation(qreal); |
| 239 | qreal scale() const; |
| 240 | void setScale(qreal); |
| 241 | |
| 242 | qreal opacity() const; |
| 243 | void setOpacity(qreal); |
| 244 | |
| 245 | bool isVisible() const; |
| 246 | void setVisible(bool); |
| 247 | |
| 248 | bool isEnabled() const; |
| 249 | void setEnabled(bool); |
| 250 | |
| 251 | bool smooth() const; |
| 252 | void setSmooth(bool); |
| 253 | |
| 254 | bool activeFocusOnTab() const; |
| 255 | void setActiveFocusOnTab(bool); |
| 256 | |
| 257 | bool antialiasing() const; |
| 258 | void setAntialiasing(bool); |
| 259 | void resetAntialiasing(); |
| 260 | |
| 261 | Flags flags() const; |
| 262 | void setFlag(Flag flag, bool enabled = true); |
| 263 | void setFlags(Flags flags); |
| 264 | |
| 265 | virtual QRectF boundingRect() const; |
| 266 | virtual QRectF clipRect() const; |
| 267 | QQuickItem *viewportItem() const; |
| 268 | |
| 269 | bool hasActiveFocus() const; |
| 270 | bool hasFocus() const; |
| 271 | void setFocus(bool); |
| 272 | void setFocus(bool focus, Qt::FocusReason reason); |
| 273 | bool isFocusScope() const; |
| 274 | QQuickItem *scopedFocusItem() const; |
| 275 | |
| 276 | Qt::FocusPolicy focusPolicy() const; |
| 277 | void setFocusPolicy(Qt::FocusPolicy policy); |
| 278 | |
| 279 | bool isAncestorOf(const QQuickItem *child) const; |
| 280 | |
| 281 | Qt::MouseButtons acceptedMouseButtons() const; |
| 282 | void setAcceptedMouseButtons(Qt::MouseButtons buttons); |
| 283 | bool acceptHoverEvents() const; |
| 284 | void setAcceptHoverEvents(bool enabled); |
| 285 | bool acceptTouchEvents() const; |
| 286 | void setAcceptTouchEvents(bool accept); |
| 287 | |
| 288 | #if QT_CONFIG(cursor) |
| 289 | QCursor cursor() const; |
| 290 | void setCursor(const QCursor &cursor); |
| 291 | void unsetCursor(); |
| 292 | #endif |
| 293 | |
| 294 | bool isUnderMouse() const; |
| 295 | void grabMouse(); |
| 296 | void ungrabMouse(); |
| 297 | bool keepMouseGrab() const; |
| 298 | void setKeepMouseGrab(bool); |
| 299 | bool filtersChildMouseEvents() const; |
| 300 | void setFiltersChildMouseEvents(bool filter); |
| 301 | |
| 302 | void grabTouchPoints(const QList<int> &ids); |
| 303 | void ungrabTouchPoints(); |
| 304 | bool keepTouchGrab() const; |
| 305 | void setKeepTouchGrab(bool); |
| 306 | |
| 307 | // implemented in qquickitemgrabresult.cpp |
| 308 | Q_REVISION(2, 4) Q_INVOKABLE bool grabToImage(const QJSValue &callback, const QSize &targetSize = QSize()); |
| 309 | QSharedPointer<QQuickItemGrabResult> grabToImage(const QSize &targetSize = QSize()); |
| 310 | |
| 311 | Q_INVOKABLE virtual bool contains(const QPointF &point) const; |
| 312 | QObject *containmentMask() const; |
| 313 | void setContainmentMask(QObject *mask); |
| 314 | |
| 315 | QTransform itemTransform(QQuickItem *, bool *) const; |
| 316 | QPointF mapToScene(const QPointF &point) const; |
| 317 | QRectF mapRectToItem(const QQuickItem *item, const QRectF &rect) const; |
| 318 | QRectF mapRectToScene(const QRectF &rect) const; |
| 319 | QPointF mapFromScene(const QPointF &point) const; |
| 320 | QRectF mapRectFromItem(const QQuickItem *item, const QRectF &rect) const; |
| 321 | QRectF mapRectFromScene(const QRectF &rect) const; |
| 322 | |
| 323 | void polish(); |
| 324 | |
| 325 | #if QT_DEPRECATED_SINCE(6, 5) |
| 326 | QT_DEPRECATED_VERSION_X_6_5("Use typed overload or mapRectFromItem" ) |
| 327 | void mapFromItem(QQmlV4FunctionPtr) const; |
| 328 | #endif |
| 329 | Q_INVOKABLE QPointF mapFromItem(const QQuickItem *item, const QPointF &point) const; |
| 330 | // overloads mainly exist for QML |
| 331 | Q_INVOKABLE QPointF mapFromItem(const QQuickItem *item, qreal x, qreal y); |
| 332 | Q_INVOKABLE QRectF mapFromItem(const QQuickItem *item, const QRectF &rect) const; |
| 333 | Q_INVOKABLE QRectF mapFromItem(const QQuickItem *item, qreal x, qreal y, qreal width, qreal height) const; |
| 334 | |
| 335 | #if QT_DEPRECATED_SINCE(6, 5) |
| 336 | QT_DEPRECATED_VERSION_X_6_5("Use typed overload or mapRectToItem" ) |
| 337 | void mapToItem(QQmlV4FunctionPtr) const; |
| 338 | #endif |
| 339 | Q_INVOKABLE QPointF mapToItem(const QQuickItem *item, const QPointF &point) const; |
| 340 | // overloads mainly exist for QML |
| 341 | Q_INVOKABLE QPointF mapToItem(const QQuickItem *item, qreal x, qreal y); |
| 342 | Q_INVOKABLE QRectF mapToItem(const QQuickItem *item, const QRectF &rect) const; |
| 343 | Q_INVOKABLE QRectF mapToItem(const QQuickItem *item, qreal x, qreal y, qreal width, qreal height) const; |
| 344 | |
| 345 | #if QT_DEPRECATED_SINCE(6, 5) |
| 346 | QT_DEPRECATED_VERSION_X_6_5("Use the typed overload" ) |
| 347 | Q_REVISION(2, 7) void mapFromGlobal(QQmlV4FunctionPtr) const; |
| 348 | #endif |
| 349 | Q_REVISION(2, 7) Q_INVOKABLE QPointF mapFromGlobal(qreal x, qreal y) const; |
| 350 | // overload mainly exists for QML |
| 351 | Q_REVISION(2, 7) Q_INVOKABLE QPointF mapFromGlobal(const QPointF &point) const; |
| 352 | |
| 353 | #if QT_DEPRECATED_SINCE(6, 5) |
| 354 | QT_DEPRECATED_VERSION_X_6_5("Use the typed overload" ) |
| 355 | Q_REVISION(2, 7) void mapToGlobal(QQmlV4FunctionPtr) const; |
| 356 | #endif |
| 357 | Q_REVISION(2, 7) Q_INVOKABLE QPointF mapToGlobal(qreal x, qreal y) const; |
| 358 | // overload only exist for QML |
| 359 | Q_REVISION(2, 7) Q_INVOKABLE QPointF mapToGlobal(const QPointF &point) const; |
| 360 | |
| 361 | Q_INVOKABLE void forceActiveFocus(); |
| 362 | Q_INVOKABLE void forceActiveFocus(Qt::FocusReason reason); |
| 363 | Q_REVISION(2, 1) Q_INVOKABLE QQuickItem *nextItemInFocusChain(bool forward = true); |
| 364 | Q_INVOKABLE QQuickItem *childAt(qreal x, qreal y) const; |
| 365 | Q_REVISION(6, 3) Q_INVOKABLE void ensurePolished(); |
| 366 | |
| 367 | Q_REVISION(6, 3) Q_INVOKABLE void dumpItemTree() const; |
| 368 | |
| 369 | #if QT_CONFIG(im) |
| 370 | virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; |
| 371 | #endif |
| 372 | |
| 373 | struct UpdatePaintNodeData { |
| 374 | QSGTransformNode *transformNode; |
| 375 | private: |
| 376 | friend class QQuickWindowPrivate; |
| 377 | UpdatePaintNodeData(); |
| 378 | }; |
| 379 | |
| 380 | virtual bool isTextureProvider() const; |
| 381 | virtual QSGTextureProvider *textureProvider() const; |
| 382 | |
| 383 | public Q_SLOTS: |
| 384 | void update(); |
| 385 | |
| 386 | Q_SIGNALS: |
| 387 | void childrenRectChanged(const QRectF &); |
| 388 | void baselineOffsetChanged(qreal); |
| 389 | void stateChanged(const QString &); |
| 390 | void focusChanged(bool); |
| 391 | void activeFocusChanged(bool); |
| 392 | Q_REVISION(6, 7) void focusPolicyChanged(Qt::FocusPolicy); |
| 393 | Q_REVISION(2, 1) void activeFocusOnTabChanged(bool); |
| 394 | void parentChanged(QQuickItem *); |
| 395 | void transformOriginChanged(TransformOrigin); |
| 396 | void smoothChanged(bool); |
| 397 | void antialiasingChanged(bool); |
| 398 | void clipChanged(bool); |
| 399 | Q_REVISION(2, 1) void windowChanged(QQuickWindow* window); |
| 400 | |
| 401 | void childrenChanged(); |
| 402 | void opacityChanged(); |
| 403 | void enabledChanged(); |
| 404 | void visibleChanged(); |
| 405 | void visibleChildrenChanged(); |
| 406 | void rotationChanged(); |
| 407 | void scaleChanged(); |
| 408 | |
| 409 | void xChanged(); |
| 410 | void yChanged(); |
| 411 | void widthChanged(); |
| 412 | void heightChanged(); |
| 413 | void zChanged(); |
| 414 | void implicitWidthChanged(); |
| 415 | void implicitHeightChanged(); |
| 416 | Q_REVISION(2, 11) void containmentMaskChanged(); |
| 417 | |
| 418 | Q_REVISION(6, 0) void paletteChanged(); |
| 419 | Q_REVISION(6, 0) void paletteCreated(); |
| 420 | |
| 421 | protected: |
| 422 | bool event(QEvent *) override; |
| 423 | |
| 424 | bool isComponentComplete() const; |
| 425 | virtual void itemChange(ItemChange, const ItemChangeData &); |
| 426 | virtual void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry); |
| 427 | |
| 428 | #if QT_CONFIG(im) |
| 429 | void updateInputMethod(Qt::InputMethodQueries queries = Qt::ImQueryInput); |
| 430 | #endif |
| 431 | |
| 432 | bool widthValid() const; // ### better name? |
| 433 | bool heightValid() const; // ### better name? |
| 434 | void setImplicitSize(qreal, qreal); |
| 435 | |
| 436 | void classBegin() override; |
| 437 | void componentComplete() override; |
| 438 | |
| 439 | virtual void keyPressEvent(QKeyEvent *event); |
| 440 | virtual void keyReleaseEvent(QKeyEvent *event); |
| 441 | #if QT_CONFIG(im) |
| 442 | virtual void inputMethodEvent(QInputMethodEvent *); |
| 443 | #endif |
| 444 | virtual void focusInEvent(QFocusEvent *); |
| 445 | virtual void focusOutEvent(QFocusEvent *); |
| 446 | virtual void mousePressEvent(QMouseEvent *event); |
| 447 | virtual void mouseMoveEvent(QMouseEvent *event); |
| 448 | virtual void mouseReleaseEvent(QMouseEvent *event); |
| 449 | virtual void mouseDoubleClickEvent(QMouseEvent *event); |
| 450 | virtual void mouseUngrabEvent(); // XXX todo - params? |
| 451 | virtual void touchUngrabEvent(); |
| 452 | #if QT_CONFIG(wheelevent) |
| 453 | virtual void wheelEvent(QWheelEvent *event); |
| 454 | #endif |
| 455 | virtual void touchEvent(QTouchEvent *event); |
| 456 | virtual void hoverEnterEvent(QHoverEvent *event); |
| 457 | virtual void hoverMoveEvent(QHoverEvent *event); |
| 458 | virtual void hoverLeaveEvent(QHoverEvent *event); |
| 459 | #if QT_CONFIG(quick_draganddrop) |
| 460 | virtual void dragEnterEvent(QDragEnterEvent *); |
| 461 | virtual void dragMoveEvent(QDragMoveEvent *); |
| 462 | virtual void dragLeaveEvent(QDragLeaveEvent *); |
| 463 | virtual void dropEvent(QDropEvent *); |
| 464 | #endif |
| 465 | virtual bool childMouseEventFilter(QQuickItem *, QEvent *); |
| 466 | #if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) |
| 467 | virtual bool contextMenuEvent(QContextMenuEvent *event); |
| 468 | #endif |
| 469 | |
| 470 | virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); |
| 471 | virtual void releaseResources(); |
| 472 | virtual void updatePolish(); |
| 473 | |
| 474 | QQuickItem(QQuickItemPrivate &dd, QQuickItem *parent = nullptr); |
| 475 | |
| 476 | private: |
| 477 | Q_PRIVATE_SLOT(d_func(), void _q_resourceObjectDeleted(QObject *)) |
| 478 | Q_PRIVATE_SLOT(d_func(), quint64 _q_createJSWrapper(QQmlV4ExecutionEnginePtr)) |
| 479 | |
| 480 | friend class QQuickWindowPrivate; |
| 481 | friend class QQuickDeliveryAgentPrivate; |
| 482 | friend class QSGRenderer; |
| 483 | friend class QAccessibleQuickItem; |
| 484 | friend class QQuickAccessibleAttached; |
| 485 | friend class QQuickAnchorChanges; |
| 486 | #ifndef QT_NO_DEBUG_STREAM |
| 487 | friend Q_QUICK_EXPORT QDebug operator<<(QDebug debug, QQuickItem *item); |
| 488 | #endif |
| 489 | |
| 490 | Q_DISABLE_COPY(QQuickItem) |
| 491 | Q_DECLARE_PRIVATE(QQuickItem) |
| 492 | }; |
| 493 | |
| 494 | Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickItem::Flags) |
| 495 | |
| 496 | #ifndef Q_QDOC |
| 497 | template <> inline QQuickItem *qobject_cast<QQuickItem *>(QObject *o) |
| 498 | { |
| 499 | if (!o || !o->isQuickItemType()) |
| 500 | return nullptr; |
| 501 | return static_cast<QQuickItem *>(o); |
| 502 | } |
| 503 | template <> inline const QQuickItem *qobject_cast<const QQuickItem *>(const QObject *o) |
| 504 | { |
| 505 | if (!o || !o->isQuickItemType()) |
| 506 | return nullptr; |
| 507 | return static_cast<const QQuickItem *>(o); |
| 508 | } |
| 509 | #endif // !Q_QDOC |
| 510 | |
| 511 | #ifndef QT_NO_DEBUG_STREAM |
| 512 | QDebug Q_QUICK_EXPORT operator<<(QDebug debug, |
| 513 | #if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) |
| 514 | const |
| 515 | #endif |
| 516 | QQuickItem *item); |
| 517 | #endif // QT_NO_DEBUG_STREAM |
| 518 | |
| 519 | QT_END_NAMESPACE |
| 520 | |
| 521 | #endif // QQUICKITEM_H |
| 522 | |