summaryrefslogtreecommitdiffstats
path: root/examples/corelib
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 /examples/corelib
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 'examples/corelib')
-rw-r--r--examples/corelib/serialization/convert/xmlconverter.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/corelib/serialization/convert/xmlconverter.cpp b/examples/corelib/serialization/convert/xmlconverter.cpp
index 87ba9b5156..c2811c5745 100644
--- a/examples/corelib/serialization/convert/xmlconverter.cpp
+++ b/examples/corelib/serialization/convert/xmlconverter.cpp
@@ -294,7 +294,7 @@ static QVariant variantFromXml(QXmlStreamReader &xml, Converter::Options options
else if (type == QLatin1String("regex"))
id = QMetaType::QRegularExpression;
else
- id = QMetaType::type(type.toLatin1());
+ id = QMetaType::fromName(type.toLatin1()).id();
if (id == QMetaType::UnknownType) {
fprintf(stderr, "%lld:%lld: Invalid XML: unknown type '%s'.\n",
xml.lineNumber(), xml.columnNumber(), qPrintable(type.toString()));
@@ -302,7 +302,7 @@ static QVariant variantFromXml(QXmlStreamReader &xml, Converter::Options options
}
result = text.toString();
- if (!result.convert(id)) {
+ if (!result.convert(QMetaType(id))) {
fprintf(stderr, "%lld:%lld: Invalid XML: could not parse content as type '%s'.\n",
xml.lineNumber(), xml.columnNumber(), qPrintable(type.toString()));
exit(EXIT_FAILURE);
@@ -433,7 +433,7 @@ static void variantToXml(QXmlStreamWriter &xml, const QVariant &v)
// does this convert to string?
const char *typeName = v.typeName();
QVariant copy = v;
- if (copy.convert(QMetaType::QString)) {
+ if (copy.convert(QMetaType(QMetaType::QString))) {
xml.writeAttribute(typeString, QString::fromLatin1(typeName));
xml.writeCharacters(copy.toString());
} else {