summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2019-05-02 14:50:31 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2020-06-11 19:39:53 +0200
commit5603be705e9e99b164bb85014c2abd0edf1d13f3 (patch)
treebde7984d714f11be054f334ea8185e30bc8197a1 /src/corelib
parent679492ecc68880babb61b4567ea5f8ef6f6293b3 (diff)
Qt6: remove support for property flags being functions
Property flags should be compile time booleans, not something to be determined at runtime. We've been using this to dynamically disable some properties in QWidget based classes dependent on the state of a different property, but this should better get implemented on top of our widgets. Change-Id: I6296e8761303ecdf24d9e842142e8596304c015d Reviewed-by: Simon Hausmann <hausmann@gmail.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/doc/src/objectmodel/properties.qdoc6
-rw-r--r--src/corelib/kernel/qmetaobject.cpp58
-rw-r--r--src/corelib/kernel/qmetaobject.h10
-rw-r--r--src/corelib/kernel/qmetaobject_p.h5
-rw-r--r--src/corelib/kernel/qobjectdefs.h5
5 files changed, 21 insertions, 63 deletions
diff --git a/src/corelib/doc/src/objectmodel/properties.qdoc b/src/corelib/doc/src/objectmodel/properties.qdoc
index abeb9b7a54..e3c506e8bc 100644
--- a/src/corelib/doc/src/objectmodel/properties.qdoc
+++ b/src/corelib/doc/src/objectmodel/properties.qdoc
@@ -110,13 +110,11 @@
\li The \c DESIGNABLE attribute indicates whether the property
should be visible in the property editor of GUI design tool (e.g.,
\l {Qt Designer Manual}{Qt Designer}). Most properties are \c DESIGNABLE
- (default true). Instead of true or false, you can specify a boolean
- member function.
+ (default true). Valid values are true and false.
\li The \c SCRIPTABLE attribute indicates whether this property
should be accessible by a scripting engine (default true).
- Instead of true or false, you can specify a boolean member
- function.
+ Valid values are true and false.
\li The \c STORED attribute indicates whether the property should
be thought of as existing on its own or as depending on other
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index eae0161c55..032f3cc019 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -133,11 +133,6 @@ QT_BEGIN_NAMESPACE
\value ReadProperty
\value WriteProperty
\value ResetProperty
- \value QueryPropertyDesignable
- \value QueryPropertyScriptable
- \value QueryPropertyStored
- \value QueryPropertyEditable
- \value QueryPropertyUser
\value CreateInstance
*/
@@ -3401,82 +3396,67 @@ bool QMetaProperty::isWritable() const
/*!
- Returns \c true if this property is designable for the given \a object;
+ Returns \c true if this property is designable;
otherwise returns \c false.
If no \a object is given, the function returns \c false if the
\c{Q_PROPERTY()}'s \c DESIGNABLE attribute is false; otherwise
- returns \c true (if the attribute is true or is a function or expression).
+ returns \c true.
\sa isScriptable(), isStored()
*/
-bool QMetaProperty::isDesignable(const QObject *object) const
+bool QMetaProperty::isDesignable() const
{
if (!mobj)
return false;
int flags = mobj->d.data[handle + 2];
bool b = flags & Designable;
- if (object) {
- void *argv[] = { &b };
- QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::QueryPropertyDesignable,
- idx + mobj->propertyOffset(), argv);
- }
return b;
}
/*!
- Returns \c true if the property is scriptable for the given \a object;
+ Returns \c true if the property is scriptable;
otherwise returns \c false.
If no \a object is given, the function returns \c false if the
\c{Q_PROPERTY()}'s \c SCRIPTABLE attribute is false; otherwise returns
- true (if the attribute is true or is a function or expression).
+ true.
\sa isDesignable(), isStored()
*/
-bool QMetaProperty::isScriptable(const QObject *object) const
+bool QMetaProperty::isScriptable() const
{
if (!mobj)
return false;
int flags = mobj->d.data[handle + 2];
bool b = flags & Scriptable;
- if (object) {
- void *argv[] = { &b };
- QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::QueryPropertyScriptable,
- idx + mobj->propertyOffset(), argv);
- }
return b;
}
/*!
- Returns \c true if the property is stored for \a object; otherwise returns
+ Returns \c true if the property is stored; otherwise returns
false.
- If no \a object is given, the function returns \c false if the
+ The function returns \c false if the
\c{Q_PROPERTY()}'s \c STORED attribute is false; otherwise returns
- true (if the attribute is true or is a function or expression).
+ true.
\sa isDesignable(), isScriptable()
*/
-bool QMetaProperty::isStored(const QObject *object) const
+bool QMetaProperty::isStored() const
{
if (!mobj)
return false;
int flags = mobj->d.data[handle + 2];
bool b = flags & Stored;
- if (object) {
- void *argv[] = { &b };
- QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::QueryPropertyStored,
- idx + mobj->propertyOffset(), argv);
- }
return b;
}
/*!
Returns \c true if this property is designated as the \c USER
- property, i.e., the one that the user can edit for \a object or
+ property, i.e., the one that the user can edit or
that is significant in some other way. Otherwise it returns
false. e.g., the \c text property is the \c USER editable property
of a QLineEdit.
@@ -3487,17 +3467,12 @@ bool QMetaProperty::isStored(const QObject *object) const
\sa QMetaObject::userProperty(), isDesignable(), isScriptable()
*/
-bool QMetaProperty::isUser(const QObject *object) const
+bool QMetaProperty::isUser() const
{
if (!mobj)
return false;
int flags = mobj->d.data[handle + 2];
bool b = flags & User;
- if (object) {
- void *argv[] = { &b };
- QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::QueryPropertyUser,
- idx + mobj->propertyOffset(), argv);
- }
return b;
}
@@ -3564,7 +3539,7 @@ bool QMetaProperty::isQProperty() const
/*!
\obsolete
- Returns \c true if the property is editable for the given \a object;
+ Returns \c true if the property is editable;
otherwise returns \c false.
If no \a object is given, the function returns \c false if the
@@ -3574,17 +3549,12 @@ bool QMetaProperty::isQProperty() const
\sa isDesignable(), isScriptable(), isStored()
*/
#if QT_DEPRECATED_SINCE(5, 15)
-bool QMetaProperty::isEditable(const QObject *object) const
+bool QMetaProperty::isEditable() const
{
if (!mobj)
return false;
int flags = mobj->d.data[handle + 2];
bool b = flags & Editable;
- if (object) {
- void *argv[] = { &b };
- QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::QueryPropertyEditable,
- idx + mobj->propertyOffset(), argv);
- }
return b;
}
#endif
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index fc7b84011b..c16cdb129a 100644
--- a/src/corelib/kernel/qmetaobject.h
+++ b/src/corelib/kernel/qmetaobject.h
@@ -289,13 +289,13 @@ public:
bool isReadable() const;
bool isWritable() const;
bool isResettable() const;
- bool isDesignable(const QObject *obj = nullptr) const;
- bool isScriptable(const QObject *obj = nullptr) const;
- bool isStored(const QObject *obj = nullptr) const;
+ bool isDesignable() const;
+ bool isScriptable() const;
+ bool isStored() const;
#if QT_DEPRECATED_SINCE(5, 15)
- QT_DEPRECATED_VERSION_5_15 bool isEditable(const QObject *obj = nullptr) const;
+ QT_DEPRECATED_VERSION_5_15 bool isEditable() const;
#endif
- bool isUser(const QObject *obj = nullptr) const;
+ bool isUser() const;
bool isConstant() const;
bool isFinal() const;
bool isRequired() const;
diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h
index 46dd7328dc..e9e3e50472 100644
--- a/src/corelib/kernel/qmetaobject_p.h
+++ b/src/corelib/kernel/qmetaobject_p.h
@@ -76,15 +76,10 @@ enum PropertyFlags {
Constant = 0x00000400,
Final = 0x00000800,
Designable = 0x00001000,
- ResolveDesignable = 0x00002000,
Scriptable = 0x00004000,
- ResolveScriptable = 0x00008000,
Stored = 0x00010000,
- ResolveStored = 0x00020000,
Editable = 0x00040000,
- ResolveEditable = 0x00080000,
User = 0x00100000,
- ResolveUser = 0x00200000,
Notify = 0x00400000,
Revisioned = 0x00800000,
Required = 0x01000000,
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index ae1abf61b9..d47c311c18 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -382,11 +382,6 @@ struct Q_CORE_EXPORT QMetaObject
ReadProperty,
WriteProperty,
ResetProperty,
- QueryPropertyDesignable,
- QueryPropertyScriptable,
- QueryPropertyStored,
- QueryPropertyEditable,
- QueryPropertyUser,
CreateInstance,
IndexOfMethod,
RegisterPropertyMetaType,