Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickitemchangelistener_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 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 QQUICKITEMCHANGELISTENER_P_H
5#define QQUICKITEMCHANGELISTENER_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick/private/qtquickglobal_p.h>
19
21
22class QRectF;
23class QQuickItem;
25
27{
28public:
29 enum Kind: int {
30 Nothing = 0x00,
31 X = 0x01,
32 Y = 0x02,
33 Width = 0x04,
34 Height = 0x08,
35
36 Size = Width | Height,
37 All = X | Y | Size
38 };
39
41 : kind(change)
42 {}
43
44 bool noChange() const { return kind == Nothing; }
45 bool anyChange() const { return !noChange(); }
46
47 bool xChange() const { return kind & X; }
48 bool yChange() const { return kind & Y; }
49 bool widthChange() const { return kind & Width; }
50 bool heightChange() const { return kind & Height; }
51
52 bool positionChange() const { return xChange() || yChange(); }
53 bool sizeChange() const { return widthChange() || heightChange(); }
54
55 bool horizontalChange() const { return xChange() || widthChange(); }
56 bool verticalChange() const { return yChange() || heightChange(); }
57
58 void setXChange(bool enabled) { set(X, enabled); }
59 void setYChange(bool enabled) { set(Y, enabled); }
62 void setSizeChange(bool enabled) { set(Size, enabled); }
66
67 void set(int bits, bool enabled)
68 {
69 if (enabled) {
70 kind |= bits;
71 } else {
72 kind &= ~bits;
73 }
74 }
75
76 bool matches(QQuickGeometryChange other) const { return kind & other.kind; }
77
78private:
79 int kind;
80};
81
82#define QT_QUICK_NEW_GEOMETRY_CHANGED_HANDLING
83
84class Q_QUICK_EXPORT QQuickItemChangeListener
85{
86public:
88
89 virtual void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF & /* oldGeometry */) {}
92 virtual void itemEnabledChanged(QQuickItem *) {}
93 virtual void itemOpacityChanged(QQuickItem *) {}
94 virtual void itemDestroyed(QQuickItem *) {}
95 virtual void itemChildAdded(QQuickItem *, QQuickItem * /* child */ ) {}
96 virtual void itemChildRemoved(QQuickItem *, QQuickItem * /* child */ ) {}
97 virtual void itemParentChanged(QQuickItem *, QQuickItem * /* parent */ ) {}
101 virtual void itemFocusChanged(QQuickItem *, Qt::FocusReason /* reason */) {}
102
103 virtual QQuickAnchorsPrivate *anchorPrivate() { return nullptr; }
104};
105
107
108#endif // QQUICKITEMCHANGELISTENER_P_H
bool matches(QQuickGeometryChange other) const
void set(int bits, bool enabled)
QQuickGeometryChange(int change=Nothing)
void setVerticalChange(bool enabled)
void setHorizontalChange(bool enabled)
virtual void itemParentChanged(QQuickItem *, QQuickItem *)
virtual void itemSiblingOrderChanged(QQuickItem *)
virtual void itemChildAdded(QQuickItem *, QQuickItem *)
virtual ~QQuickItemChangeListener()
virtual void itemRotationChanged(QQuickItem *)
virtual void itemEnabledChanged(QQuickItem *)
virtual void itemOpacityChanged(QQuickItem *)
virtual void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &)
virtual void itemImplicitWidthChanged(QQuickItem *)
virtual void itemChildRemoved(QQuickItem *, QQuickItem *)
virtual QQuickAnchorsPrivate * anchorPrivate()
virtual void itemDestroyed(QQuickItem *)
virtual void itemVisibilityChanged(QQuickItem *)
virtual void itemImplicitHeightChanged(QQuickItem *)
virtual void itemFocusChanged(QQuickItem *, Qt::FocusReason)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
\inmodule QtCore\reentrant
Definition qrect.h:484
Combined button and popup list for selecting options.
FocusReason
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * bits
QFuture< QSet< QChar > > set
[10]
QSharedPointer< T > other(t)
[5]