Add QObject::isQuickItemType() for convenience

Change-Id: Ibde4e919ba028117336974eb7a804aa11c1ee086
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Yuhang Zhao 2021-12-13 11:38:15 +08:00
parent 50ad52d804
commit 054b814daa
2 changed files with 15 additions and 1 deletions

View File

@ -197,6 +197,7 @@ QObjectPrivate::QObjectPrivate(int version)
metaObject = nullptr;
isWindow = false;
deleteLaterCalled = false;
isQuickItem = false;
}
QObjectPrivate::~QObjectPrivate()
@ -1303,6 +1304,17 @@ QBindable<QString> QObject::bindableObjectName()
\c{inherits("QWindow")}, except that it is much faster.
*/
/*!
\fn bool QObject::isQuickItemType() const
Returns \c true if the object is a QQuickItem; otherwise returns \c false.
Calling this function is equivalent to calling
\c{inherits("QQuickItem")}, except that it is much faster.
\since 6.4
*/
/*!
This virtual function receives events to an object and should
return true if the event \a e was recognized and processed.

View File

@ -107,7 +107,8 @@ public:
uint receiveChildEvents : 1;
uint isWindow : 1; // for QWindow
uint deleteLaterCalled : 1;
uint unused : 24;
uint isQuickItem : 1;
uint unused : 23;
int postedEvents;
QDynamicMetaObjectData *metaObject;
QBindingStorage bindingStorage;
@ -147,6 +148,7 @@ public:
inline bool isWidgetType() const { return d_ptr->isWidget; }
inline bool isWindowType() const { return d_ptr->isWindow; }
inline bool isQuickItemType() const { return d_ptr->isQuickItem; }
inline bool signalsBlocked() const noexcept { return d_ptr->blockSig; }
bool blockSignals(bool b) noexcept;