summaryrefslogtreecommitdiffstats
path: root/src/tools
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/tools
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/tools')
-rw-r--r--src/tools/moc/generator.cpp134
-rw-r--r--src/tools/moc/moc.cpp7
2 files changed, 9 insertions, 132 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 849e25b76d..2278ba2603 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -869,35 +869,23 @@ void Generator::generateProperties()
if (p.stdCppSet())
flags |= StdCppSet;
}
+
if (!p.reset.isEmpty())
flags |= Resettable;
-// if (p.override)
-// flags |= Override;
-
- if (p.designable.isEmpty())
- flags |= ResolveDesignable;
- else if (p.designable != "false")
+ if (p.designable != "false")
flags |= Designable;
- if (p.scriptable.isEmpty())
- flags |= ResolveScriptable;
- else if (p.scriptable != "false")
+ if (p.scriptable != "false")
flags |= Scriptable;
- if (p.stored.isEmpty())
- flags |= ResolveStored;
- else if (p.stored != "false")
+ if (p.stored != "false")
flags |= Stored;
- if (p.editable.isEmpty())
- flags |= ResolveEditable;
- else if (p.editable != "false")
+ if (p.editable != "false")
flags |= Editable;
- if (p.user.isEmpty())
- flags |= ResolveUser;
- else if (p.user != "false")
+ if (p.user != "false")
flags |= User;
if (p.notifyId != -1)
@@ -1045,19 +1033,6 @@ void Generator::generateMetacall()
}
if (cdef->propertyList.size()) {
- bool needDesignable = false;
- bool needScriptable = false;
- bool needStored = false;
- bool needEditable = false;
- bool needUser = false;
- for (int i = 0; i < cdef->propertyList.size(); ++i) {
- const PropertyDef &p = cdef->propertyList.at(i);
- needDesignable |= p.designable.endsWith(')');
- needScriptable |= p.scriptable.endsWith(')');
- needStored |= p.stored.endsWith(')');
- needEditable |= p.editable.endsWith(')');
- needUser |= p.user.endsWith(')');
- }
fprintf(out, "\n#ifndef QT_NO_PROPERTIES\n ");
if (needElse)
@@ -1069,103 +1044,6 @@ void Generator::generateMetacall()
" || _c == QMetaObject::SetQPropertyBinding) {\n"
" qt_static_metacall(this, _c, _id, _a);\n"
" _id -= %d;\n }", cdef->propertyList.count());
-
- fprintf(out, " else ");
- fprintf(out, "if (_c == QMetaObject::QueryPropertyDesignable) {\n");
- if (needDesignable) {
- fprintf(out, " bool *_b = reinterpret_cast<bool*>(_a[0]);\n");
- fprintf(out, " switch (_id) {\n");
- for (int propindex = 0; propindex < cdef->propertyList.size(); ++propindex) {
- const PropertyDef &p = cdef->propertyList.at(propindex);
- if (!p.designable.endsWith(')'))
- continue;
- fprintf(out, " case %d: *_b = %s; break;\n",
- propindex, p.designable.constData());
- }
- fprintf(out, " default: break;\n");
- fprintf(out, " }\n");
- }
- fprintf(out,
- " _id -= %d;\n"
- " }", cdef->propertyList.count());
-
- fprintf(out, " else ");
- fprintf(out, "if (_c == QMetaObject::QueryPropertyScriptable) {\n");
- if (needScriptable) {
- fprintf(out, " bool *_b = reinterpret_cast<bool*>(_a[0]);\n");
- fprintf(out, " switch (_id) {\n");
- for (int propindex = 0; propindex < cdef->propertyList.size(); ++propindex) {
- const PropertyDef &p = cdef->propertyList.at(propindex);
- if (!p.scriptable.endsWith(')'))
- continue;
- fprintf(out, " case %d: *_b = %s; break;\n",
- propindex, p.scriptable.constData());
- }
- fprintf(out, " default: break;\n");
- fprintf(out, " }\n");
- }
- fprintf(out,
- " _id -= %d;\n"
- " }", cdef->propertyList.count());
-
- fprintf(out, " else ");
- fprintf(out, "if (_c == QMetaObject::QueryPropertyStored) {\n");
- if (needStored) {
- fprintf(out, " bool *_b = reinterpret_cast<bool*>(_a[0]);\n");
- fprintf(out, " switch (_id) {\n");
- for (int propindex = 0; propindex < cdef->propertyList.size(); ++propindex) {
- const PropertyDef &p = cdef->propertyList.at(propindex);
- if (!p.stored.endsWith(')'))
- continue;
- fprintf(out, " case %d: *_b = %s; break;\n",
- propindex, p.stored.constData());
- }
- fprintf(out, " default: break;\n");
- fprintf(out, " }\n");
- }
- fprintf(out,
- " _id -= %d;\n"
- " }", cdef->propertyList.count());
-
- fprintf(out, " else ");
- fprintf(out, "if (_c == QMetaObject::QueryPropertyEditable) {\n");
- if (needEditable) {
- fprintf(out, " bool *_b = reinterpret_cast<bool*>(_a[0]);\n");
- fprintf(out, " switch (_id) {\n");
- for (int propindex = 0; propindex < cdef->propertyList.size(); ++propindex) {
- const PropertyDef &p = cdef->propertyList.at(propindex);
- if (!p.editable.endsWith(')'))
- continue;
- fprintf(out, " case %d: *_b = %s; break;\n",
- propindex, p.editable.constData());
- }
- fprintf(out, " default: break;\n");
- fprintf(out, " }\n");
- }
- fprintf(out,
- " _id -= %d;\n"
- " }", cdef->propertyList.count());
-
-
- fprintf(out, " else ");
- fprintf(out, "if (_c == QMetaObject::QueryPropertyUser) {\n");
- if (needUser) {
- fprintf(out, " bool *_b = reinterpret_cast<bool*>(_a[0]);\n");
- fprintf(out, " switch (_id) {\n");
- for (int propindex = 0; propindex < cdef->propertyList.size(); ++propindex) {
- const PropertyDef &p = cdef->propertyList.at(propindex);
- if (!p.user.endsWith(')'))
- continue;
- fprintf(out, " case %d: *_b = %s; break;\n",
- propindex, p.user.constData());
- }
- fprintf(out, " default: break;\n");
- fprintf(out, " }\n");
- }
- fprintf(out,
- " _id -= %d;\n"
- " }", cdef->propertyList.count());
-
fprintf(out, "\n#endif // QT_NO_PROPERTIES");
}
if (methodList.size() || cdef->propertyList.size())
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 0ffbe7bb13..bfbcde1507 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -1267,8 +1267,7 @@ void Moc::createPropertyDef(PropertyDef &propDef)
if (typeWrappedInQProperty)
next(RANGLE);
propDef.designable = propDef.scriptable = propDef.stored = "true";
- propDef.user = "false";
-
+ propDef.user = propDef.editable = "false";
/*
The Q_PROPERTY construct cannot contain any commas, since
commas separate macro arguments. We therefore expect users
@@ -1301,8 +1300,8 @@ void Moc::parsePropertyAttributes(PropertyDef &propDef)
if (def.endsWith(')')) {
QByteArray msg = "Providing a function for ";
msg += name;
- msg += " in a property declaration is deprecated and will not be supported in Qt 6 anymore.";
- warning(msg.constData());
+ msg += " in a property declaration is not be supported in Qt 6.";
+ error(msg.constData());
}
};