summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-08-04 10:35:46 +0200
committerLars Knoll <lars.knoll@qt.io>2020-08-24 00:19:05 +0200
commit1697fbdf05ff643d617a9ba1614454926e86a3d9 (patch)
tree1c090fd9254ccedf33e724158e115157998304cf /tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
parent92b37676328a960bc092b1f3834233c550376457 (diff)
Deprecate the static int based API in QMetaType
And remove one of the type id to name mapping that still existed in QMetaType. QMetaTypeInterface can provide that, so there's no need to have a second copy of the data. qMetaTypeTypeInternal() can still map all the names of all builtin types to ids. That functionality is for now still required by moc and can't be removed yet. Change-Id: Ib4f8e9c71e1e7d99d52da9e44477c9a1f1805e57 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp')
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index caeb9f656f..49f9be0ce2 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -268,8 +268,8 @@ struct GenericGadgetType : BaseGenericType
if (_c == QMetaObject::ReadProperty) {
if (_id < properties.size()) {
const auto &prop = properties.at(_id);
- QMetaType::destruct(int(prop.userType()), _a[0]);
- QMetaType::construct(int(prop.userType()), _a[0], prop.constData());
+ prop.metaType().destruct(_a[0]);
+ prop.metaType().construct(_a[0], prop.constData());
}
} else if (_c == QMetaObject::WriteProperty) {
if (_id < properties.size()) {
@@ -402,7 +402,7 @@ void tst_QMetaType::registerGadget(const char *name, const QList<GadgetPropertyT
gadgetBuilder.setFlags(metaObjectflags);
auto dynamicGadgetProperties = std::make_shared<GenericGadgetType>();
for (const auto &prop : gadgetProperties) {
- int propertyType = QMetaType::type(prop.type);
+ int propertyType = QMetaType::fromName(prop.type).id();
dynamicGadgetProperties->properties.push_back(QVariant(QMetaType(propertyType)));
auto dynamicPropery = gadgetBuilder.addProperty(prop.name, prop.type);
dynamicPropery.setWritable(true);
@@ -715,6 +715,9 @@ void tst_QMetaType::typeName()
QFETCH(int, aType);
QFETCH(QString, aTypeName);
+ if (aType >= QMetaType::FirstWidgetsType)
+ QSKIP("The test doesn't link against QtWidgets.");
+
const char *rawname = QMetaType::typeName(aType);
QString name = QString::fromLatin1(rawname);
@@ -753,6 +756,8 @@ void tst_QMetaType::type()
QFETCH(int, aType);
QFETCH(QByteArray, aTypeName);
+ if (aType >= QMetaType::FirstWidgetsType)
+ QSKIP("The test doesn't link against QtWidgets.");
// QMetaType::type(QByteArray)
QCOMPARE(QMetaType::type(aTypeName), aType);
// QMetaType::type(const char *)
@@ -1978,11 +1983,6 @@ DECLARE_NONSTREAMABLE(QPersistentModelIndex)
DECLARE_NONSTREAMABLE(QObject*)
DECLARE_NONSTREAMABLE(QWidget*)
-#define DECLARE_GUI_CLASS_NONSTREAMABLE(MetaTypeName, MetaTypeId, RealType) \
- DECLARE_NONSTREAMABLE(RealType)
-QT_FOR_EACH_STATIC_GUI_CLASS(DECLARE_GUI_CLASS_NONSTREAMABLE)
-#undef DECLARE_GUI_CLASS_NONSTREAMABLE
-
#define DECLARE_WIDGETS_CLASS_NONSTREAMABLE(MetaTypeName, MetaTypeId, RealType) \
DECLARE_NONSTREAMABLE(RealType)
QT_FOR_EACH_STATIC_WIDGETS_CLASS(DECLARE_WIDGETS_CLASS_NONSTREAMABLE)