aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjk <[email protected]>2024-05-23 09:37:34 +0200
committerhjk <[email protected]>2024-05-23 13:04:22 +0000
commitf30d369b99831bc7934c00c9c6ecbcb9680e1cee (patch)
tree7901dd6753115d735565c829b067dfd36fbe478c
parentaf3ab760ad4cfc81c264291db1dda5e0da037599 (diff)
Fix QMetaType::type() related deprecation warnings
Not in sdktool, which still builds with Qt 5.15 Change-Id: I6e6f4331127b821e471e2840e7959cd65e6419e9 Reviewed-by: Eike Ziller <[email protected]>
-rw-r--r--src/libs/qmljs/jsoncheck.cpp14
-rw-r--r--src/libs/sqlite/sqlitevalue.h14
-rw-r--r--src/libs/utils/filepath.cpp2
-rw-r--r--src/libs/utils/macroexpander.cpp2
-rw-r--r--src/libs/utils/persistentsettings.cpp30
-rw-r--r--src/libs/utils/store.cpp6
-rw-r--r--src/libs/utils/treemodel.cpp6
-rw-r--r--src/libs/utils/wizard.cpp4
-rw-r--r--src/plugins/android/androidconfigurations.cpp2
-rw-r--r--src/plugins/android/androidrunnerworker.cpp6
-rw-r--r--src/plugins/bazaar/bazaarplugin.cpp6
-rw-r--r--src/plugins/cmakeprojectmanager/cmakekitaspect.cpp2
-rw-r--r--src/plugins/coreplugin/actionmanager/actionmanager.cpp2
-rw-r--r--src/plugins/debugger/debuggerkitaspect.cpp2
-rw-r--r--src/plugins/debugger/qml/qmlengine.cpp14
-rw-r--r--src/plugins/debugger/qml/qmlinspectoragent.cpp6
-rw-r--r--src/plugins/debugger/watchdata.h2
-rw-r--r--src/plugins/debugger/watchdelegatewidgets.cpp50
-rw-r--r--src/plugins/debugger/watchdelegatewidgets.h2
-rw-r--r--src/plugins/debugger/watchhandler.cpp24
-rw-r--r--src/plugins/designer/formtemplatewizardpage.cpp2
-rw-r--r--src/plugins/fakevim/fakevimhandler.cpp2
-rw-r--r--src/plugins/fossil/fossilplugin.cpp6
-rw-r--r--src/plugins/mcusupport/mcukitaspect.cpp4
-rw-r--r--src/plugins/mercurial/mercurialplugin.cpp6
-rw-r--r--src/plugins/mesonprojectmanager/buildoptionsmodel.cpp10
-rw-r--r--src/plugins/perfprofiler/perftimelinemodel.cpp8
-rw-r--r--src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp22
-rw-r--r--src/plugins/projectexplorer/jsonwizard/jsonkitspage.cpp6
-rw-r--r--src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp8
-rw-r--r--src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp24
-rw-r--r--src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp2
-rw-r--r--src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp8
-rw-r--r--src/plugins/projectexplorer/jsonwizard/jsonwizardscannergenerator.cpp2
-rw-r--r--src/plugins/projectexplorer/jsonwizard/wizarddebug.h4
-rw-r--r--src/plugins/projectexplorer/kitaspects.cpp4
-rw-r--r--src/plugins/projectexplorer/runconfigurationaspects.cpp2
-rw-r--r--src/plugins/projectexplorer/userfileaccessor.cpp22
-rw-r--r--src/plugins/qbsprojectmanager/qbsprofilemanager.cpp6
-rw-r--r--src/plugins/qmldesigner/components/collectioneditor/datastoremodelnode.cpp2
-rw-r--r--src/plugins/qmldesigner/components/componentcore/propertycomponentgenerator.cpp2
-rw-r--r--src/plugins/qmldesigner/components/listmodeleditor/listmodeleditormodel.cpp2
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp4
-rw-r--r--src/plugins/qmldesigner/components/timelineeditor/timelinesettingsmodel.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/metainfo/metainforeader.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/propertycontainer.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/rewriterview.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/projectstorage/typeannotationreader.cpp6
-rw-r--r--src/plugins/scxmleditor/plugin_interface/scattributeitemdelegate.cpp6
-rw-r--r--src/plugins/scxmleditor/plugin_interface/scattributeitemmodel.cpp6
-rw-r--r--src/plugins/scxmleditor/plugin_interface/scxmltypes.h112
-rw-r--r--src/plugins/squish/squishwizardpages.cpp2
-rw-r--r--src/plugins/vcsbase/vcsbaseeditor.cpp2
-rw-r--r--src/plugins/vcsbase/wizard/vcscommandpage.cpp14
-rw-r--r--src/plugins/vcsbase/wizard/vcsconfigurationpage.cpp2
-rw-r--r--src/tools/qml2puppet/qml2puppet/instances/objectnodeinstance.cpp2
-rw-r--r--src/tools/qml2puppet/qmlprivategate/qmlprivategate.cpp4
-rw-r--r--tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp52
-rw-r--r--tests/auto/utils/persistentsettings/tst_persistentsettings.cpp6
-rw-r--r--tests/unit/tests/unittests/componentcore/propertycomponentgenerator-test.cpp2
-rw-r--r--tests/unit/tests/unittests/listmodeleditor/listmodeleditor-test.cpp10
62 files changed, 295 insertions, 295 deletions
diff --git a/src/libs/qmljs/jsoncheck.cpp b/src/libs/qmljs/jsoncheck.cpp
index 1d7c04e50cf..3cb44111f9d 100644
--- a/src/libs/qmljs/jsoncheck.cpp
+++ b/src/libs/qmljs/jsoncheck.cpp
@@ -447,7 +447,7 @@ JsonValue *JsonValue::build(const QVariant &variant, JsonMemoryPool *pool)
{
switch (variant.typeId()) {
- case QVariant::List: {
+ case QMetaType::QVariantList: {
auto newValue = new (pool) JsonArrayValue;
const QList<QVariant> list = variant.toList();
for (const QVariant &element : list)
@@ -455,7 +455,7 @@ JsonValue *JsonValue::build(const QVariant &variant, JsonMemoryPool *pool)
return newValue;
}
- case QVariant::Map: {
+ case QMetaType::QVariantMap: {
auto newValue = new (pool) JsonObjectValue;
const QVariantMap variantMap = variant.toMap();
for (QVariantMap::const_iterator it = variantMap.begin(); it != variantMap.end(); ++it)
@@ -463,19 +463,19 @@ JsonValue *JsonValue::build(const QVariant &variant, JsonMemoryPool *pool)
return newValue;
}
- case QVariant::String:
+ case QMetaType::QString:
return new (pool) JsonStringValue(variant.toString());
- case QVariant::Int:
+ case QMetaType::Int:
return new (pool) JsonIntValue(variant.toInt());
- case QVariant::Double:
+ case QMetaType::Double:
return new (pool) JsonDoubleValue(variant.toDouble());
- case QVariant::Bool:
+ case QMetaType::Bool:
return new (pool) JsonBooleanValue(variant.toBool());
- case QVariant::Invalid:
+ case QMetaType::UnknownType:
return new (pool) JsonNullValue;
default:
diff --git a/src/libs/sqlite/sqlitevalue.h b/src/libs/sqlite/sqlitevalue.h
index 725682494bd..7adadb43b35 100644
--- a/src/libs/sqlite/sqlitevalue.h
+++ b/src/libs/sqlite/sqlitevalue.h
@@ -373,18 +373,18 @@ private:
if (value.isNull())
return VariantType{NullValue{}};
- switch (value.userType()) {
- case QVariant::Int:
+ switch (value.typeId()) {
+ case QMetaType::Int:
return VariantType{static_cast<long long>(value.toInt())};
- case QVariant::LongLong:
+ case QMetaType::LongLong:
return VariantType{value.toLongLong()};
- case QVariant::UInt:
+ case QMetaType::UInt:
return VariantType{static_cast<long long>(value.toUInt())};
- case QVariant::Double:
+ case QMetaType::Double:
return VariantType{value.toFloat()};
- case QVariant::String:
+ case QMetaType::QString:
return VariantType{value.toString()};
- case QVariant::ByteArray:
+ case QMetaType::QByteArray:
return VariantType{Blob{value.toByteArray()}};
default:
throw CannotConvert();
diff --git a/src/libs/utils/filepath.cpp b/src/libs/utils/filepath.cpp
index b62f222475c..0965a52b1f3 100644
--- a/src/libs/utils/filepath.cpp
+++ b/src/libs/utils/filepath.cpp
@@ -1367,7 +1367,7 @@ FilePath FilePath::fromUtf8(const char *filename, int filenameSize)
FilePath FilePath::fromSettings(const QVariant &variant)
{
- if (variant.type() == QVariant::Url) {
+ if (variant.typeId() == QMetaType::QUrl) {
const QUrl url = variant.toUrl();
return FilePath::fromParts(url.scheme(), url.host(), url.path());
}
diff --git a/src/libs/utils/macroexpander.cpp b/src/libs/utils/macroexpander.cpp
index dd57cd6b5a0..fc138974745 100644
--- a/src/libs/utils/macroexpander.cpp
+++ b/src/libs/utils/macroexpander.cpp
@@ -284,7 +284,7 @@ QByteArray MacroExpander::expand(const QByteArray &stringWithVariables) const
QVariant MacroExpander::expandVariant(const QVariant &v) const
{
- const auto type = QMetaType::Type(v.type());
+ const int type = v.typeId();
if (type == QMetaType::QString) {
return expand(v.toString());
} else if (type == QMetaType::QStringList) {
diff --git a/src/libs/utils/persistentsettings.cpp b/src/libs/utils/persistentsettings.cpp
index 54a829004b3..3702ecf960b 100644
--- a/src/libs/utils/persistentsettings.cpp
+++ b/src/libs/utils/persistentsettings.cpp
@@ -106,13 +106,13 @@ const QString keyAttribute("key");
struct ParseValueStackEntry
{
- explicit ParseValueStackEntry(QVariant::Type t = QVariant::Invalid, const QString &k = {}) : type(t), key(k) {}
+ explicit ParseValueStackEntry(QMetaType::Type t = QMetaType::UnknownType, const QString &k = {}) : typeId(t), key(k) {}
explicit ParseValueStackEntry(const QVariant &aSimpleValue, const QString &k);
QVariant value() const;
void addChild(const QString &key, const QVariant &v);
- QVariant::Type type;
+ QMetaType::Type typeId;
QString key;
QVariant simpleValue;
QVariantList listValue;
@@ -120,19 +120,19 @@ struct ParseValueStackEntry
};
ParseValueStackEntry::ParseValueStackEntry(const QVariant &aSimpleValue, const QString &k)
- : type(aSimpleValue.type()), key(k), simpleValue(aSimpleValue)
+ : typeId(QMetaType::Type(aSimpleValue.typeId())), key(k), simpleValue(aSimpleValue)
{
QTC_ASSERT(simpleValue.isValid(), return);
}
QVariant ParseValueStackEntry::value() const
{
- switch (type) {
- case QVariant::Invalid:
+ switch (typeId) {
+ case QMetaType::UnknownType:
return QVariant();
- case QVariant::Map:
+ case QMetaType::QVariantMap:
return QVariant(mapValue);
- case QVariant::List:
+ case QMetaType::QVariantList:
return QVariant(listValue);
default:
break;
@@ -142,16 +142,16 @@ QVariant ParseValueStackEntry::value() const
void ParseValueStackEntry::addChild(const QString &key, const QVariant &v)
{
- switch (type) {
- case QVariant::Map:
+ switch (typeId) {
+ case QMetaType::QVariantMap:
mapValue.insert(key, v);
break;
- case QVariant::List:
+ case QMetaType::QVariantList:
listValue.push_back(v);
break;
default:
qWarning() << "ParseValueStackEntry::Internal error adding " << key << v << " to "
- << QVariant::typeToName(type) << value();
+ << QMetaType(typeId).name() << value();
break;
}
}
@@ -226,14 +226,14 @@ bool ParseContext::handleStartElement(QXmlStreamReader &r)
const QXmlStreamAttributes attributes = r.attributes();
const QString key = attributes.hasAttribute(keyAttribute) ?
attributes.value(keyAttribute).toString() : QString();
- m_valueStack.push_back(ParseValueStackEntry(QVariant::List, key));
+ m_valueStack.push_back(ParseValueStackEntry(QMetaType::QVariantList, key));
return false;
}
if (name == valueMapElement) {
const QXmlStreamAttributes attributes = r.attributes();
const QString key = attributes.hasAttribute(keyAttribute) ?
attributes.value(keyAttribute).toString() : QString();
- m_valueStack.push_back(ParseValueStackEntry(QVariant::Map, key));
+ m_valueStack.push_back(ParseValueStackEntry(QMetaType::QVariantMap, key));
return false;
}
return false;
@@ -369,8 +369,8 @@ static void writeVariantValue(QXmlStreamWriter &w, const QVariant &variant, cons
w.writeAttribute(typeAttribute, QLatin1String(variant.typeName()));
if (!key.isEmpty())
w.writeAttribute(keyAttribute, xmlAttrFromKey(key));
- switch (variant.type()) {
- case QVariant::Rect:
+ switch (variant.typeId()) {
+ case QMetaType::QRect:
w.writeCharacters(rectangleToString(variant.toRect()));
break;
default:
diff --git a/src/libs/utils/store.cpp b/src/libs/utils/store.cpp
index fa8d4232c02..8c0e2a6046a 100644
--- a/src/libs/utils/store.cpp
+++ b/src/libs/utils/store.cpp
@@ -50,10 +50,10 @@ static QVariantList mapListFromStoreList(const QVariantList &storeList);
QVariant storeEntryFromMapEntry(const QVariant &mapEntry)
{
- if (mapEntry.type() == QVariant::Map)
+ if (mapEntry.typeId() == QMetaType::QVariantMap)
return QVariant::fromValue(storeFromMap(mapEntry.toMap()));
- if (mapEntry.type() == QVariant::List)
+ if (mapEntry.typeId() == QMetaType::QVariantList)
return QVariant::fromValue(storeListFromMapList(mapEntry.toList()));
return mapEntry;
@@ -64,7 +64,7 @@ QVariant mapEntryFromStoreEntry(const QVariant &storeEntry)
if (storeEntry.metaType() == QMetaType::fromType<Store>())
return QVariant::fromValue(mapFromStore(storeEntry.value<Store>()));
- if (storeEntry.type() == QVariant::List)
+ if (storeEntry.typeId() == QMetaType::QVariantList)
return QVariant::fromValue(mapListFromStoreList(storeEntry.toList()));
return storeEntry;
diff --git a/src/libs/utils/treemodel.cpp b/src/libs/utils/treemodel.cpp
index 4649bb43c86..edddb2d484e 100644
--- a/src/libs/utils/treemodel.cpp
+++ b/src/libs/utils/treemodel.cpp
@@ -459,13 +459,13 @@ void ModelTest::data()
// General Purpose roles that should return a QString
QVariant variant = model->data(model->index(0, 0), Qt::ToolTipRole);
if (variant.isValid())
- Q_ASSERT(variant.canConvert(QVariant::String));
+ Q_ASSERT(variant.canConvert(QMetaType::QString));
variant = model->data(model->index(0, 0), Qt::StatusTipRole);
if (variant.isValid())
- Q_ASSERT(variant.canConvert(QVariant::String));
+ Q_ASSERT(variant.canConvert(QMetaType::QString));
variant = model->data(model->index(0, 0), Qt::WhatsThisRole);
if (variant.isValid())
- Q_ASSERT(variant.canConvert(QVariant::String));
+ Q_ASSERT(variant.canConvert(QMetaType::QString));
// General Purpose roles that should return a QSize
variant = model->data(model->index(0, 0), Qt::SizeHintRole);
diff --git a/src/libs/utils/wizard.cpp b/src/libs/utils/wizard.cpp
index 10d801c5214..f611d512319 100644
--- a/src/libs/utils/wizard.cpp
+++ b/src/libs/utils/wizard.cpp
@@ -365,8 +365,8 @@ QHash<QString, QVariant> Wizard::variables() const
QString typeOf(const QVariant &v)
{
QString result;
- switch (v.type()) {
- case QVariant::Map:
+ switch (v.typeId()) {
+ case QMetaType::QVariantMap:
result = QLatin1String("Object");
break;
default:
diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp
index f5d4036a4fc..5e69111ac29 100644
--- a/src/plugins/android/androidconfigurations.cpp
+++ b/src/plugins/android/androidconfigurations.cpp
@@ -197,7 +197,7 @@ void AndroidConfig::load(const QtcSettings &settings)
{
// user settings
QVariant emulatorArgs = settings.value(EmulatorArgsKey, QString("-netdelay none -netspeed full"));
- if (emulatorArgs.typeId() == QVariant::StringList) // Changed in 8.0 from QStringList to QString.
+ if (emulatorArgs.typeId() == QMetaType::QStringList) // Changed in 8.0 from QStringList to QString.
emulatorArgs = ProcessArgs::joinArgs(emulatorArgs.toStringList());
m_emulatorArgs = emulatorArgs.toString();
m_sdkLocation = FilePath::fromUserInput(settings.value(SDKLocationKey).toString()).cleanPath();
diff --git a/src/plugins/android/androidrunnerworker.cpp b/src/plugins/android/androidrunnerworker.cpp
index 503dba0d289..30e0a3b14fb 100644
--- a/src/plugins/android/androidrunnerworker.cpp
+++ b/src/plugins/android/androidrunnerworker.cpp
@@ -174,14 +174,14 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa
if (const Store sd = runControl->settingsData(Constants::ANDROID_AM_START_ARGS);
!sd.values().isEmpty()) {
- QTC_CHECK(sd.first().type() == QVariant::String);
+ QTC_CHECK(sd.first().typeId() == QMetaType::QString);
const QString startArgs = sd.first().toString();
m_amStartExtraArgs = ProcessArgs::splitArgs(startArgs, OsTypeOtherUnix);
}
if (const Store sd = runControl->settingsData(Constants::ANDROID_PRESTARTSHELLCMDLIST);
!sd.values().isEmpty()) {
- QTC_CHECK(sd.first().type() == QVariant::String);
+ QTC_CHECK(sd.first().typeId() == QMetaType::QString);
const QStringList commands = sd.first().toString().split('\n', Qt::SkipEmptyParts);
for (const QString &shellCmd : commands)
m_beforeStartAdbCommands.append(QString("shell %1").arg(shellCmd));
@@ -189,7 +189,7 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa
if (const Store sd = runControl->settingsData(Constants::ANDROID_POSTFINISHSHELLCMDLIST);
!sd.values().isEmpty()) {
- QTC_CHECK(sd.first().type() == QVariant::String);
+ QTC_CHECK(sd.first().typeId() == QMetaType::QString);
const QStringList commands = sd.first().toString().split('\n', Qt::SkipEmptyParts);
for (const QString &shellCmd : commands)
m_afterFinishAdbCommands.append(QString("shell %1").arg(shellCmd));
diff --git a/src/plugins/bazaar/bazaarplugin.cpp b/src/plugins/bazaar/bazaarplugin.cpp
index 1e0485d2bf1..47c4bd8f8c5 100644
--- a/src/plugins/bazaar/bazaarplugin.cpp
+++ b/src/plugins/bazaar/bazaarplugin.cpp
@@ -957,11 +957,11 @@ VcsCommand *BazaarPluginPrivate::createInitialCheckoutCommand(const QString &url
void BazaarPluginPrivate::changed(const QVariant &v)
{
- switch (v.type()) {
- case QVariant::String:
+ switch (v.typeId()) {
+ case QMetaType::QString:
emit repositoryChanged(FilePath::fromVariant(v));
break;
- case QVariant::StringList:
+ case QMetaType::QStringList:
emit filesChanged(v.toStringList());
break;
default:
diff --git a/src/plugins/cmakeprojectmanager/cmakekitaspect.cpp b/src/plugins/cmakeprojectmanager/cmakekitaspect.cpp
index 3d8aa654751..d55f3b506b8 100644
--- a/src/plugins/cmakeprojectmanager/cmakekitaspect.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakekitaspect.cpp
@@ -800,7 +800,7 @@ void CMakeGeneratorKitAspectFactory::upgrade(Kit *k)
QTC_ASSERT(k, return);
const QVariant value = k->value(GENERATOR_ID);
- if (value.type() != QVariant::Map) {
+ if (value.typeId() != QMetaType::QVariantMap) {
GeneratorInfo info;
const QString fullName = value.toString();
const int pos = fullName.indexOf(" - ");
diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.cpp b/src/plugins/coreplugin/actionmanager/actionmanager.cpp
index 9176ad5660d..b9bbf23f85f 100644
--- a/src/plugins/coreplugin/actionmanager/actionmanager.cpp
+++ b/src/plugins/coreplugin/actionmanager/actionmanager.cpp
@@ -875,7 +875,7 @@ void ActionManagerPrivate::readUserSettings(Id id, Command *cmd)
settings->beginGroup(kKeyboardSettingsKeyV2);
if (settings->contains(id.toKey())) {
const QVariant v = settings->value(id.toKey());
- if (QMetaType::Type(v.type()) == QMetaType::QStringList) {
+ if (v.typeId() == QMetaType::QStringList) {
cmd->setKeySequences(Utils::transform<QList>(v.toStringList(), [](const QString &s) {
return QKeySequence::fromString(s);
}));
diff --git a/src/plugins/debugger/debuggerkitaspect.cpp b/src/plugins/debugger/debuggerkitaspect.cpp
index 02f21c582a2..d7952f69cc3 100644
--- a/src/plugins/debugger/debuggerkitaspect.cpp
+++ b/src/plugins/debugger/debuggerkitaspect.cpp
@@ -329,7 +329,7 @@ public:
}
if (!item.detectionSource().isEmpty() && item.detectionSource() == k->autoDetectionSource())
level = DebuggerItem::MatchLevel(level + 2);
- } else if (rawId.type() == QVariant::String) {
+ } else if (rawId.typeId() == QMetaType::QString) {
// New structure.
if (item.id() == rawId) {
// Detected by ID.
diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp
index dda927f0f17..c214926ec48 100644
--- a/src/plugins/debugger/qml/qmlengine.cpp
+++ b/src/plugins/debugger/qml/qmlengine.cpp
@@ -783,7 +783,7 @@ void QmlEngine::assignValueInDebugger(WatchItem *item,
const QString &expression, const QVariant &editValue)
{
if (!expression.isEmpty()) {
- QTC_CHECK(editValue.typeId() == QVariant::String);
+ QTC_CHECK(editValue.typeId() == QMetaType::QString);
QVariant value;
QString val = editValue.toString();
if (item->type == "boolean")
@@ -861,7 +861,7 @@ static ConsoleItem *constructLogItemTree(const QVariant &result, const QString &
QString text;
ConsoleItem *item = nullptr;
- if (result.typeId() == QVariant::Map) {
+ if (result.typeId() == QMetaType::QVariantMap) {
if (key.isEmpty())
text = "Object";
else
@@ -885,7 +885,7 @@ static ConsoleItem *constructLogItemTree(const QVariant &result, const QString &
item->appendChild(child);
}
- } else if (result.typeId() == QVariant::List) {
+ } else if (result.typeId() == QMetaType::QVariantList) {
if (key.isEmpty())
text = "List";
else
@@ -904,7 +904,7 @@ static ConsoleItem *constructLogItemTree(const QVariant &result, const QString &
if (child)
item->appendChild(child);
}
- } else if (result.canConvert(QVariant::String)) {
+ } else if (result.canConvert(QMetaType::QString)) {
item = new ConsoleItem(ConsoleItem::DefaultType, result.toString());
} else {
item = new ConsoleItem(ConsoleItem::DefaultType, "Unknown Value");
@@ -1356,9 +1356,9 @@ void QmlEnginePrivate::scripts(int types, const QList<int> ids, bool includeSour
if (includeSource)
cmd.arg(INCLUDESOURCE, includeSource);
- if (filter.typeId() == QVariant::String)
+ if (filter.typeId() == QMetaType::QString)
cmd.arg(FILTER, filter.toString());
- else if (filter.typeId() == QVariant::Int)
+ else if (filter.typeId() == QMetaType::Int)
cmd.arg(FILTER, filter.toInt());
else
QTC_CHECK(!filter.isValid());
@@ -2041,7 +2041,7 @@ StackFrame QmlEnginePrivate::extractStackFrame(const QVariant &bodyVal)
}
auto extractString = [this](const QVariant &item) {
- return (item.typeId() == QVariant::String ? item : extractData(item).value).toString();
+ return (item.typeId() == QMetaType::QString ? item : extractData(item).value).toString();
};
stackFrame.function = extractString(body.value("func"));
diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp
index 9e30d2ad838..2769d49cd60 100644
--- a/src/plugins/debugger/qml/qmlinspectoragent.cpp
+++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp
@@ -220,7 +220,7 @@ void QmlInspectorAgent::onResult(quint32 queryId, const QVariant &value,
if (m_objectTreeQueryIds.contains(queryId)) {
m_objectTreeQueryIds.removeOne(queryId);
- if (value.typeId() == QVariant::List) {
+ if (value.typeId() == QMetaType::QVariantList) {
const QVariantList objList = value.toList();
for (const QVariant &var : objList) {
// TODO: check which among the list is the actual
@@ -289,7 +289,7 @@ static void sortChildrenIfNecessary(WatchItem *propertiesWatch)
static bool insertChildren(WatchItem *parent, const QVariant &value)
{
switch (value.typeId()) {
- case QVariant::Map: {
+ case QMetaType::QVariantMap: {
const QVariantMap map = value.toMap();
for (auto it = map.begin(), end = map.end(); it != end; ++it) {
auto child = new WatchItem;
@@ -303,7 +303,7 @@ static bool insertChildren(WatchItem *parent, const QVariant &value)
sortChildrenIfNecessary(parent);
return true;
}
- case QVariant::List: {
+ case QMetaType::QVariantList: {
const QVariantList list = value.toList();
for (int i = 0, end = list.size(); i != end; ++i) {
auto child = new WatchItem;
diff --git a/src/plugins/debugger/watchdata.h b/src/plugins/debugger/watchdata.h
index 672ded5e7c6..914e92decfb 100644
--- a/src/plugins/debugger/watchdata.h
+++ b/src/plugins/debugger/watchdata.h
@@ -33,7 +33,7 @@ public:
QString toToolTip() const;
QVariant editValue() const;
- int editType() const;
+ QMetaType::Type editType() const;
static const qint64 InvalidId = -1;
constexpr static char loadMoreName[] = "<load more>";
diff --git a/src/plugins/debugger/watchdelegatewidgets.cpp b/src/plugins/debugger/watchdelegatewidgets.cpp
index b9337f2eea7..ecaa0fda91e 100644
--- a/src/plugins/debugger/watchdelegatewidgets.cpp
+++ b/src/plugins/debugger/watchdelegatewidgets.cpp
@@ -189,25 +189,25 @@ void IntegerWatchLineEdit::setModelData(const QVariant &v)
qDebug(">IntegerLineEdit::setModelData(%s, '%s'): base=%d, signed=%d, bigint=%d",
v.typeName(), qPrintable(v.toString()),
base(), isSigned(), isBigInt());
- switch (v.type()) {
- case QVariant::Int:
- case QVariant::LongLong: {
+ switch (v.typeId()) {
+ case QMetaType::Int:
+ case QMetaType::LongLong: {
const qint64 iv = v.toLongLong();
setSigned(true);
setText(QString::number(iv, base()));
}
break;
- case QVariant::UInt:
- case QVariant::ULongLong: {
+ case QMetaType::UInt:
+ case QMetaType::ULongLong: {
const quint64 iv = v.toULongLong();
setSigned(false);
setText(QString::number(iv, base()));
}
break;
- case QVariant::ByteArray:
+ case QMetaType::QByteArray:
setNumberText(QString::fromLatin1(v.toByteArray()));
break;
- case QVariant::String:
+ case QMetaType::QString:
setNumberText(v.toString());
break;
default:
@@ -243,12 +243,12 @@ void FloatWatchLineEdit::setModelData(const QVariant &v)
if (debug)
qDebug("FloatWatchLineEdit::setModelData(%s, '%s')",
v.typeName(), qPrintable(v.toString()));
- switch (v.type()) {
- case QVariant::Double:
- case QVariant::String:
+ switch (v.typeId()) {
+ case QMetaType::Double:
+ case QMetaType::QString:
setText(v.toString());
break;
- case QVariant::ByteArray:
+ case QMetaType::QByteArray:
setText(QString::fromLatin1(v.toByteArray()));
break;
default:
@@ -259,17 +259,17 @@ void FloatWatchLineEdit::setModelData(const QVariant &v)
}
}
-WatchLineEdit *WatchLineEdit::create(QVariant::Type t, QWidget *parent)
+WatchLineEdit *WatchLineEdit::create(QMetaType::Type typeId, QWidget *parent)
{
- switch (t) {
- case QVariant::Bool:
- case QVariant::Int:
- case QVariant::UInt:
- case QVariant::LongLong:
- case QVariant::ULongLong:
+ switch (typeId) {
+ case QMetaType::Bool:
+ case QMetaType::Int:
+ case QMetaType::UInt:
+ case QMetaType::LongLong:
+ case QMetaType::ULongLong:
return new IntegerWatchLineEdit(parent);
break;
- case QVariant::Double:
+ case QMetaType::Double:
return new FloatWatchLineEdit(parent);
default:
break;
@@ -297,14 +297,14 @@ void BooleanComboBox::setModelData(const QVariant &v)
qDebug("BooleanComboBox::setModelData(%s, '%s')", v.typeName(), qPrintable(v.toString()));
bool value = false;
- switch (v.type()) {
- case QVariant::Bool:
+ switch (v.typeId()) {
+ case QMetaType::Bool:
value = v.toBool();
break;
- case QVariant::Int:
- case QVariant::UInt:
- case QVariant::LongLong:
- case QVariant::ULongLong:
+ case QMetaType::Int:
+ case QMetaType::UInt:
+ case QMetaType::LongLong:
+ case QMetaType::ULongLong:
value = v.toInt() != 0;
break;
default:
diff --git a/src/plugins/debugger/watchdelegatewidgets.h b/src/plugins/debugger/watchdelegatewidgets.h
index 68b1dd24032..54b85c62574 100644
--- a/src/plugins/debugger/watchdelegatewidgets.h
+++ b/src/plugins/debugger/watchdelegatewidgets.h
@@ -27,7 +27,7 @@ public:
virtual QVariant modelData() const;
virtual void setModelData(const QVariant &);
- static WatchLineEdit *create(QVariant::Type t, QWidget *parent = nullptr);
+ static WatchLineEdit *create(QMetaType::Type typeId, QWidget *parent = nullptr);
};
/* Watch delegate line edit for integer numbers based on quint64/qint64.
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index 3f47df4b887..0fd0d535f6c 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -844,33 +844,33 @@ static inline quint64 pointerValue(QString data)
}
// Return the type used for editing
-int WatchItem::editType() const
+QMetaType::Type WatchItem::editType() const
{
if (type == "bool")
- return QVariant::Bool;
+ return QMetaType::Bool;
if (isIntType(type))
- return type.contains('u') ? QVariant::ULongLong : QVariant::LongLong;
+ return type.contains('u') ? QMetaType::ULongLong : QMetaType::LongLong;
if (isFloatType(type))
- return QVariant::Double;
+ return QMetaType::Double;
// Check for pointers using hex values (0xAD00 "Hallo")
if (isPointerType(type) && value.startsWith("0x"))
- return QVariant::ULongLong;
- return QVariant::String;
+ return QMetaType::ULongLong;
+ return QMetaType::QString;
}
// Convert to editable (see above)
QVariant WatchItem::editValue() const
{
switch (editType()) {
- case QVariant::Bool:
+ case QMetaType::Bool:
return value != "0" && value != "false";
- case QVariant::ULongLong:
+ case QMetaType::ULongLong:
if (isPointerType(type)) // Fix pointer values (0xAD00 "Hallo" -> 0xAD00)
return QVariant(pointerValue(value));
return QVariant(value.toULongLong());
- case QVariant::LongLong:
+ case QMetaType::LongLong:
return QVariant(value.toLongLong());
- case QVariant::Double:
+ case QMetaType::Double:
return QVariant(value.toDouble());
default:
break;
@@ -2888,8 +2888,8 @@ public:
// Value column: Custom editor. Apply integer-specific settings.
if (index.column() == 1) {
- auto editType = QVariant::Type(item->editType());
- if (editType == QVariant::Bool)
+ const QMetaType::Type editType = item->editType();
+ if (editType == QMetaType::Bool)
return new BooleanComboBox(parent);
WatchLineEdit *edit = WatchLineEdit::create(editType, parent);
diff --git a/src/plugins/designer/formtemplatewizardpage.cpp b/src/plugins/designer/formtemplatewizardpage.cpp
index 68e3fb17111..cfe02e52632 100644
--- a/src/plugins/designer/formtemplatewizardpage.cpp
+++ b/src/plugins/designer/formtemplatewizardpage.cpp
@@ -45,7 +45,7 @@ Utils::WizardPage *FormPageFactory::create(ProjectExplorer::JsonWizard *wizard,
bool FormPageFactory::validateData(Utils::Id typeId, const QVariant &data, QString *errorMessage)
{
QTC_ASSERT(canCreate(typeId), return false);
- if (!data.isNull() && (data.type() != QVariant::Map || !data.toMap().isEmpty())) {
+ if (!data.isNull() && (data.typeId() != QMetaType::QVariantMap || !data.toMap().isEmpty())) {
*errorMessage = ::ProjectExplorer::Tr::tr(
"\"data\" for a \"Form\" page needs to be unset or an empty object.");
return false;
diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp
index 1e25113fe3b..29257505f21 100644
--- a/src/plugins/fakevim/fakevimhandler.cpp
+++ b/src/plugins/fakevim/fakevimhandler.cpp
@@ -6123,7 +6123,7 @@ bool FakeVimHandler::Private::handleExSetCommand(const ExCommand &cmd)
FvBaseAspect *act = s.item(Utils::keyFromString(optionName));
if (!act) {
showMessage(MessageError, Tr::tr("Unknown option:") + ' ' + cmd.args);
- } else if (act->defaultVariantValue().type() == QVariant::Bool) {
+ } else if (act->defaultVariantValue().typeId() == QMetaType::Bool) {
bool oldValue = act->variantValue().toBool();
if (printOption) {
showMessage(MessageInfo, QLatin1String(oldValue ? "" : "no")
diff --git a/src/plugins/fossil/fossilplugin.cpp b/src/plugins/fossil/fossilplugin.cpp
index 8bf61894af7..9821607033f 100644
--- a/src/plugins/fossil/fossilplugin.cpp
+++ b/src/plugins/fossil/fossilplugin.cpp
@@ -989,11 +989,11 @@ VcsCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QString &sou
void FossilPluginPrivate::changed(const QVariant &v)
{
- switch (v.type()) {
- case QVariant::String:
+ switch (v.typeId()) {
+ case QMetaType::QString:
emit repositoryChanged(FilePath::fromVariant(v));
break;
- case QVariant::StringList:
+ case QMetaType::QStringList:
emit filesChanged(v.toStringList());
break;
default:
diff --git a/src/plugins/mcusupport/mcukitaspect.cpp b/src/plugins/mcusupport/mcukitaspect.cpp
index 8d497f209dd..44823bd45df 100644
--- a/src/plugins/mcusupport/mcukitaspect.cpp
+++ b/src/plugins/mcusupport/mcukitaspect.cpp
@@ -78,7 +78,7 @@ public:
const QVariant checkFormat = kit->value(McuDependenciesKitAspect::id());
if (!checkFormat.isValid() || checkFormat.isNull())
return result;
- if (!checkFormat.canConvert(QVariant::List))
+ if (!checkFormat.canConvert(QMetaType::QVariantList))
return {BuildSystemTask(Task::Error, Tr::tr("The MCU dependencies setting value is invalid."))};
// check paths defined in cmake variables for given dependencies exist
@@ -105,7 +105,7 @@ public:
QTC_ASSERT(kit, return );
const QVariant variant = kit->value(McuDependenciesKitAspect::id());
- if (!variant.isNull() && !variant.canConvert(QVariant::List)) {
+ if (!variant.isNull() && !variant.canConvert(QMetaType::QVariantList)) {
qWarning("Kit \"%s\" has a wrong mcu dependencies value set.",
qPrintable(kit->displayName()));
McuDependenciesKitAspect::setDependencies(kit, Utils::EnvironmentItems());
diff --git a/src/plugins/mercurial/mercurialplugin.cpp b/src/plugins/mercurial/mercurialplugin.cpp
index f3c63547fa7..39b3fe44320 100644
--- a/src/plugins/mercurial/mercurialplugin.cpp
+++ b/src/plugins/mercurial/mercurialplugin.cpp
@@ -753,11 +753,11 @@ bool MercurialPluginPrivate::sccManaged(const QString &filename)
void MercurialPluginPrivate::changed(const QVariant &v)
{
- switch (v.type()) {
- case QVariant::String:
+ switch (v.typeId()) {
+ case QMetaType::QString:
emit repositoryChanged(FilePath::fromVariant(v));
break;
- case QVariant::StringList:
+ case QMetaType::QStringList:
emit filesChanged(v.toStringList());
break;
default:
diff --git a/src/plugins/mesonprojectmanager/buildoptionsmodel.cpp b/src/plugins/mesonprojectmanager/buildoptionsmodel.cpp
index 1f8e7acd9ba..f8db40b7498 100644
--- a/src/plugins/mesonprojectmanager/buildoptionsmodel.cpp
+++ b/src/plugins/mesonprojectmanager/buildoptionsmodel.cpp
@@ -118,25 +118,25 @@ bool BuidOptionsModel::hasChanges() const
QWidget *BuildOptionDelegate::makeWidget(QWidget *parent, const QVariant &data)
{
- auto type = data.userType();
+ const int type = data.typeId();
switch (type) {
- case QVariant::Int: {
+ case QMetaType::Int: {
auto w = new QSpinBox{parent};
w->setValue(data.toInt());
return w;
}
- case QVariant::Bool: {
+ case QMetaType::Bool: {
auto w = new QComboBox{parent};
w->addItems({"false", "true"});
w->setCurrentIndex(data.toBool());
return w;
}
- case QVariant::StringList: {
+ case QMetaType::QStringList: {
auto w = new ArrayOptionLineEdit{parent};
w->setPlainText(data.toStringList().join(" "));
return w;
}
- case QVariant::String: {
+ case QMetaType::QString: {
auto w = new QLineEdit{parent};
w->setText(data.toString());
return w;
diff --git a/src/plugins/perfprofiler/perftimelinemodel.cpp b/src/plugins/perfprofiler/perftimelinemodel.cpp
index fac136024b2..904a73fe434 100644
--- a/src/plugins/perfprofiler/perftimelinemodel.cpp
+++ b/src/plugins/perfprofiler/perftimelinemodel.cpp
@@ -86,12 +86,12 @@ QVariantList PerfTimelineModel::labels() const
QString prettyPrintTraceData(const QVariant &data)
{
- switch (data.type()) {
- case QVariant::ULongLong:
+ switch (data.typeId()) {
+ case QMetaType::ULongLong:
return QString::fromLatin1("0x%1").arg(data.toULongLong(), 16, 16, QLatin1Char('0'));
- case QVariant::UInt:
+ case QMetaType::UInt:
return QString::fromLatin1("0x%1").arg(data.toUInt(), 8, 16, QLatin1Char('0'));
- case QVariant::List: {
+ case QMetaType::QVariantList: {
QStringList ret;
for (const QVariant &item : data.toList())
ret.append(prettyPrintTraceData(item));
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp
index 49a0ed89571..55ee3790977 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp
@@ -166,7 +166,7 @@ QVariant JsonFieldPage::Field::toSettings() const
JsonFieldPage::Field *JsonFieldPage::Field::parse(const QVariant &input, QString *errorMessage)
{
- if (input.typeId() != QVariant::Map) {
+ if (input.typeId() != QMetaType::QVariantMap) {
*errorMessage = Tr::tr("Field is not an object.");
return nullptr;
}
@@ -409,7 +409,7 @@ QDebug &operator<<(QDebug &debug, const JsonFieldPage::Field &field)
bool LabelField::parseData(const QVariant &data, QString *errorMessage)
{
- if (data.typeId() != QVariant::Map) {
+ if (data.typeId() != QMetaType::QVariantMap) {
*errorMessage = Tr::tr("Label (\"%1\") data is not an object.").arg(name());
return false;
}
@@ -447,7 +447,7 @@ bool SpacerField::parseData(const QVariant &data, QString *errorMessage)
if (data.isNull())
return true;
- if (data.typeId() != QVariant::Map) {
+ if (data.typeId() != QMetaType::QVariantMap) {
*errorMessage = Tr::tr("Spacer (\"%1\") data is not an object.").arg(name());
return false;
}
@@ -492,7 +492,7 @@ bool LineEditField::parseData(const QVariant &data, QString *errorMessage)
if (data.isNull())
return true;
- if (data.typeId() != QVariant::Map) {
+ if (data.typeId() != QMetaType::QVariantMap) {
*errorMessage = Tr::tr("LineEdit (\"%1\") data is not an object.").arg(name());
return false;
}
@@ -689,7 +689,7 @@ bool TextEditField::parseData(const QVariant &data, QString *errorMessage)
if (data.isNull())
return true;
- if (data.typeId() != QVariant::Map) {
+ if (data.typeId() != QMetaType::QVariantMap) {
*errorMessage = Tr::tr("TextEdit (\"%1\") data is not an object.")
.arg(name());
return false;
@@ -772,7 +772,7 @@ bool PathChooserField::parseData(const QVariant &data, QString *errorMessage)
if (data.isNull())
return true;
- if (data.typeId() != QVariant::Map) {
+ if (data.typeId() != QMetaType::QVariantMap) {
*errorMessage = Tr::tr("PathChooser data is not an object.");
return false;
}
@@ -877,7 +877,7 @@ bool CheckBoxField::parseData(const QVariant &data, QString *errorMessage)
if (data.isNull())
return true;
- if (data.typeId() != QVariant::Map) {
+ if (data.typeId() != QMetaType::QVariantMap) {
*errorMessage = Tr::tr("CheckBox (\"%1\") data is not an object.").arg(name());
return false;
}
@@ -966,12 +966,12 @@ QVariant CheckBoxField::toSettings() const
std::unique_ptr<QStandardItem> createStandardItemFromListItem(const QVariant &item, QString *errorMessage)
{
- if (item.typeId() == QVariant::List) {
+ if (item.typeId() == QMetaType::QVariantList) {
*errorMessage = Tr::tr("No JSON lists allowed inside List items.");
return {};
}
auto standardItem = std::make_unique<QStandardItem>();
- if (item.typeId() == QVariant::Map) {
+ if (item.typeId() == QMetaType::QVariantMap) {
QVariantMap tmp = item.toMap();
const QString key = JsonWizardFactory::localizedString(consumeValue(tmp, "trKey", QString()).toString());
const QVariant value = consumeValue(tmp, "value", key);
@@ -1001,7 +1001,7 @@ ListField::~ListField() = default;
bool ListField::parseData(const QVariant &data, QString *errorMessage)
{
- if (data.typeId() != QVariant::Map) {
+ if (data.typeId() != QMetaType::QVariantMap) {
*errorMessage = Tr::tr("%1 (\"%2\") data is not an object.").arg(type(), name());
return false;
}
@@ -1027,7 +1027,7 @@ bool ListField::parseData(const QVariant &data, QString *errorMessage)
*errorMessage = Tr::tr("%1 (\"%2\") \"items\" missing.").arg(type(), name());
return false;
}
- if (value.typeId() != QVariant::List) {
+ if (value.typeId() != QMetaType::QVariantList) {
*errorMessage = Tr::tr("%1 (\"%2\") \"items\" is not a JSON list.").arg(type(), name());
return false;
}
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonkitspage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonkitspage.cpp
index 930d8d22f4f..6e76633dafb 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonkitspage.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonkitspage.cpp
@@ -124,7 +124,7 @@ QVector<JsonKitsPage::ConditionalFeature> JsonKitsPage::parseFeatures(const QVar
if (data.isNull())
return result;
- if (data.type() != QVariant::List) {
+ if (data.typeId() != QMetaType::QVariantList) {
if (errorMessage)
*errorMessage = Tr::tr("Feature list is set and not of type list.");
return result;
@@ -132,9 +132,9 @@ QVector<JsonKitsPage::ConditionalFeature> JsonKitsPage::parseFeatures(const QVar
const QList<QVariant> elements = data.toList();
for (const QVariant &element : elements) {
- if (element.type() == QVariant::String) {
+ if (element.typeId() == QMetaType::QString) {
result.append({ element.toString(), QVariant(true) });
- } else if (element.type() == QVariant::Map) {
+ } else if (element.typeId() == QMetaType::QVariantMap) {
const QVariantMap obj = element.toMap();
const QString feature = obj.value(QLatin1String(KEY_FEATURE)).toString();
if (feature.isEmpty()) {
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp
index 83b8b81bef6..3d846604ba5 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp
@@ -219,14 +219,14 @@ QString JsonWizard::stringValue(const QString &n) const
if (!v.isValid())
return {};
- if (v.typeId() == QVariant::String) {
+ if (v.typeId() == QMetaType::QString) {
QString tmp = m_expander.expand(v.toString());
if (tmp.isEmpty())
tmp = QString::fromLatin1(""); // Make sure isNull() is *not* true.
return tmp;
}
- if (v.typeId() == QVariant::StringList)
+ if (v.typeId() == QMetaType::QStringList)
return stringListToArrayString(v.toStringList(), &m_expander);
return v.toString();
@@ -277,7 +277,7 @@ QVariant JsonWizard::value(const QString &n) const
bool JsonWizard::boolFromVariant(const QVariant &v, MacroExpander *expander)
{
- if (v.typeId() == QVariant::String) {
+ if (v.typeId() == QMetaType::QString) {
const QString tmp = expander->expand(v.toString());
return !(tmp.isEmpty() || tmp == QLatin1String("false"));
}
@@ -419,7 +419,7 @@ void JsonWizard::handleError(const QString &message)
QString JsonWizard::stringify(const QVariant &v) const
{
- if (v.typeId() == QVariant::StringList)
+ if (v.typeId() == QMetaType::QStringList)
return stringListToArrayString(v.toStringList(), &m_expander);
return Wizard::stringify(v);
}
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp
index 9c00a323297..ba3f4696e0c 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp
@@ -147,7 +147,7 @@ static JsonWizardFactory::Generator parseGenerator(const QVariant &value, QStrin
{
JsonWizardFactory::Generator gen;
- if (value.typeId() != QVariant::Map) {
+ if (value.typeId() != QMetaType::QVariantMap) {
*errorMessage = Tr::tr("Generator is not a object.");
return gen;
}
@@ -308,8 +308,8 @@ QVariant JsonWizardFactory::getDataValue(const QLatin1String &key, const QVarian
{
QVariant retVal = {};
- if ((valueSet.contains(key) && valueSet.value(key).typeId() == QVariant::Map) ||
- (defaultValueSet.contains(key) && defaultValueSet.value(key).typeId() == QVariant::Map)) {
+ if ((valueSet.contains(key) && valueSet.value(key).typeId() == QMetaType::QVariantMap) ||
+ (defaultValueSet.contains(key) && defaultValueSet.value(key).typeId() == QMetaType::QVariantMap)) {
retVal = mergeDataValueMaps(valueSet.value(key), defaultValueSet.value(key));
} else {
QVariant defaultValue = defaultValueSet.value(key, notExistValue);
@@ -335,7 +335,7 @@ std::pair<int, QStringList> JsonWizardFactory::screenSizeInfoFromPage(const QStr
return {};
const QVariant data = it->data;
- if (data.typeId() != QVariant::List)
+ if (data.typeId() != QMetaType::QVariantList)
return {};
const QVariant screenFactorField = Utils::findOrDefault(data.toList(),
@@ -344,11 +344,11 @@ std::pair<int, QStringList> JsonWizardFactory::screenSizeInfoFromPage(const QStr
return "ScreenFactor" == m["name"];
});
- if (screenFactorField.typeId() != QVariant::Map)
+ if (screenFactorField.typeId() != QMetaType::QVariantMap)
return {};
const QVariant screenFactorData = screenFactorField.toMap()["data"];
- if (screenFactorData.typeId() != QVariant::Map)
+ if (screenFactorData.typeId() != QMetaType::QVariantMap)
return {};
const QVariantMap screenFactorDataMap = screenFactorData.toMap();
@@ -376,7 +376,7 @@ JsonWizardFactory::Page JsonWizardFactory::parsePage(const QVariant &value, QStr
{
JsonWizardFactory::Page p;
- if (value.typeId() != QVariant::Map) {
+ if (value.typeId() != QMetaType::QVariantMap) {
*errorMessage = Tr::tr("Page is not an object.");
return p;
}
@@ -423,9 +423,9 @@ JsonWizardFactory::Page JsonWizardFactory::parsePage(const QVariant &value, QStr
if (specifiedSubData.isNull())
subData = defaultSubData;
- else if (specifiedSubData.typeId() == QVariant::Map)
+ else if (specifiedSubData.typeId() == QMetaType::QVariantMap)
subData = mergeDataValueMaps(specifiedSubData.toMap(), defaultSubData.toMap());
- else if (specifiedSubData.typeId() == QVariant::List)
+ else if (specifiedSubData.typeId() == QMetaType::QVariantList)
subData = specifiedSubData;
if (!factory->validateData(typeId, subData, errorMessage))
@@ -741,9 +741,9 @@ QList<QVariant> JsonWizardFactory::objectOrList(const QVariant &data, QString *e
QList<QVariant> result;
if (data.isNull())
*errorMessage = Tr::tr("key not found.");
- else if (data.typeId() == QVariant::Map)
+ else if (data.typeId() == QMetaType::QVariantMap)
result.append(data);
- else if (data.typeId() == QVariant::List)
+ else if (data.typeId() == QMetaType::QVariantList)
result = data.toList();
else
*errorMessage = Tr::tr("Expected an object or a list.");
@@ -754,7 +754,7 @@ QString JsonWizardFactory::localizedString(const QVariant &value)
{
if (value.isNull())
return {};
- if (value.typeId() == QVariant::Map) {
+ if (value.typeId() == QMetaType::QVariantMap) {
QVariantMap tmp = value.toMap();
const QString locale = languageSetting().toLower();
QStringList locales;
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp
index c7409fbc467..c6f6900d045 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp
@@ -79,7 +79,7 @@ bool JsonWizardFileGenerator::setup(const QVariant &data, QString *errorMessage)
return false;
for (const QVariant &d : list) {
- if (d.type() != QVariant::Map) {
+ if (d.typeId() != QMetaType::QVariantMap) {
*errorMessage = Tr::tr("Files data list entry is not an object.");
return false;
}
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp
index 02f26d8401d..45b2a4aa780 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp
@@ -114,7 +114,7 @@ WizardPage *FilePageFactory::create(JsonWizard *wizard, Id typeId, const QVarian
bool FilePageFactory::validateData(Id typeId, const QVariant &data, QString *errorMessage)
{
QTC_ASSERT(canCreate(typeId), return false);
- if (!data.isNull() && (data.typeId() != QVariant::Map || !data.toMap().isEmpty())) {
+ if (!data.isNull() && (data.typeId() != QMetaType::QVariantMap || !data.toMap().isEmpty())) {
*errorMessage = Tr::tr("\"data\" for a \"File\" page needs to be unset or an empty object.");
return false;
}
@@ -174,7 +174,7 @@ bool KitsPageFactory::validateData(Id typeId, const QVariant &data, QString *err
{
QTC_ASSERT(canCreate(typeId), return false);
- if (data.isNull() || data.typeId() != QVariant::Map) {
+ if (data.isNull() || data.typeId() != QMetaType::QVariantMap) {
*errorMessage = Tr::tr("\"data\" must be a JSON object for \"Kits\" pages.");
return false;
}
@@ -242,7 +242,7 @@ bool ProjectPageFactory::validateData(Id typeId, const QVariant &data, QString *
Q_UNUSED(errorMessage)
QTC_ASSERT(canCreate(typeId), return false);
- if (!data.isNull() && data.typeId() != QVariant::Map) {
+ if (!data.isNull() && data.typeId() != QMetaType::QVariantMap) {
*errorMessage = Tr::tr("\"data\" must be empty or a JSON object for \"Project\" pages.");
return false;
}
@@ -297,7 +297,7 @@ WizardPage *SummaryPageFactory::create(JsonWizard *wizard, Id typeId, const QVar
bool SummaryPageFactory::validateData(Id typeId, const QVariant &data, QString *errorMessage)
{
QTC_ASSERT(canCreate(typeId), return false);
- if (!data.isNull() && (data.typeId() != QVariant::Map)) {
+ if (!data.isNull() && (data.typeId() != QMetaType::QVariantMap)) {
*errorMessage = Tr::tr("\"data\" for a \"Summary\" page can be unset or needs to be an object.");
return false;
}
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardscannergenerator.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardscannergenerator.cpp
index a7b2b9b6eec..9122ccc5eee 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonwizardscannergenerator.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardscannergenerator.cpp
@@ -46,7 +46,7 @@ bool JsonWizardScannerGenerator::setup(const QVariant &data, QString *errorMessa
if (data.isNull())
return true;
- if (data.type() != QVariant::Map) {
+ if (data.typeId() != QMetaType::QVariantMap) {
*errorMessage = Tr::tr("Key is not an object.");
return false;
}
diff --git a/src/plugins/projectexplorer/jsonwizard/wizarddebug.h b/src/plugins/projectexplorer/jsonwizard/wizarddebug.h
index 63f8891670c..6878407d9a0 100644
--- a/src/plugins/projectexplorer/jsonwizard/wizarddebug.h
+++ b/src/plugins/projectexplorer/jsonwizard/wizarddebug.h
@@ -26,10 +26,10 @@ inline QDebug &operator<<(QDebug &dbg, const QVariant &var)
case QMetaType::QStringList:
dbg << var.toList();
break;
- case QVariant::List:
+ case QMetaType::QVariantList:
dbg << var.toList();
break;
- case QVariant::Map:
+ case QMetaType::QVariantMap:
dbg << var.toMap();
break;
default: {
diff --git a/src/plugins/projectexplorer/kitaspects.cpp b/src/plugins/projectexplorer/kitaspects.cpp
index 0eef454d284..a91ef0cf689 100644
--- a/src/plugins/projectexplorer/kitaspects.cpp
+++ b/src/plugins/projectexplorer/kitaspects.cpp
@@ -1539,7 +1539,7 @@ Tasks EnvironmentKitAspectFactory::validate(const Kit *k) const
QTC_ASSERT(k, return result);
const QVariant variant = k->value(EnvironmentKitAspect::id());
- if (!variant.isNull() && !variant.canConvert(QVariant::List))
+ if (!variant.isNull() && !variant.canConvert(QMetaType::QVariantList))
result << BuildSystemTask(Task::Error, Tr::tr("The environment setting value is invalid."));
return result;
@@ -1550,7 +1550,7 @@ void EnvironmentKitAspectFactory::fix(Kit *k)
QTC_ASSERT(k, return);
const QVariant variant = k->value(EnvironmentKitAspect::id());
- if (!variant.isNull() && !variant.canConvert(QVariant::List)) {
+ if (!variant.isNull() && !variant.canConvert(QMetaType::QVariantList)) {
qWarning("Kit \"%s\" has a wrong environment value set.", qPrintable(k->displayName()));
EnvironmentKitAspect::setEnvironmentChanges(k, EnvironmentItems());
}
diff --git a/src/plugins/projectexplorer/runconfigurationaspects.cpp b/src/plugins/projectexplorer/runconfigurationaspects.cpp
index c042f081f1d..6a580f5f4ba 100644
--- a/src/plugins/projectexplorer/runconfigurationaspects.cpp
+++ b/src/plugins/projectexplorer/runconfigurationaspects.cpp
@@ -401,7 +401,7 @@ void ArgumentsAspect::fromMap(const Store &map)
{
QVariant args = map.value(settingsKey());
// Until 3.7 a QStringList was stored for Remote Linux
- if (args.typeId() == QVariant::StringList)
+ if (args.typeId() == QMetaType::QStringList)
m_arguments = ProcessArgs::joinArgs(args.toStringList(), OsTypeLinux);
else
m_arguments = args.toString();
diff --git a/src/plugins/projectexplorer/userfileaccessor.cpp b/src/plugins/projectexplorer/userfileaccessor.cpp
index 82e4d0edfbf..d5929353774 100644
--- a/src/plugins/projectexplorer/userfileaccessor.cpp
+++ b/src/plugins/projectexplorer/userfileaccessor.cpp
@@ -453,7 +453,7 @@ Store UserFileVersion14Upgrader::upgrade(const Store &map)
{
Store result;
for (auto it = map.cbegin(), end = map.cend(); it != end; ++it) {
- if (it.value().typeId() == QVariant::Map)
+ if (it.value().typeId() == QMetaType::QVariantMap)
result.insert(it.key(), variantFromStore(upgrade(storeFromVariant(it.value()))));
else if (it.key() == "AutotoolsProjectManager.AutotoolsBuildConfiguration.BuildDirectory"
|| it.key() == "CMakeProjectManager.CMakeBuildConfiguration.BuildDirectory"
@@ -709,13 +709,13 @@ Store UserFileVersion17Upgrader::upgrade(const Store &map)
QVariant UserFileVersion17Upgrader::process(const QVariant &entry)
{
switch (entry.typeId()) {
- case QVariant::List: {
+ case QMetaType::QVariantList: {
QVariantList result;
for (const QVariant &item : entry.toList())
result.append(process(item));
return result;
}
- case QVariant::Map: {
+ case QMetaType::QVariantMap: {
Store result = storeFromVariant(entry);
for (Store::iterator i = result.begin(), end = result.end(); i != end; ++i) {
QVariant &v = i.value();
@@ -737,9 +737,9 @@ Store UserFileVersion18Upgrader::upgrade(const Store &map)
QVariant UserFileVersion18Upgrader::process(const QVariant &entry)
{
switch (entry.typeId()) {
- case QVariant::List:
+ case QMetaType::QVariantList:
return Utils::transform(entry.toList(), &UserFileVersion18Upgrader::process);
- case QVariant::Map: {
+ case QMetaType::QVariantMap: {
Store map = storeFromVariant(entry);
Store result;
for (auto it = map.cbegin(), end = map.cend(); it != end; ++it) {
@@ -793,10 +793,10 @@ QVariant UserFileVersion19Upgrader::process(const QVariant &entry, const KeyList
static const KeyList dyldKeys = {"Qbs.RunConfiguration.UseDyldImageSuffix",
"QmakeProjectManager.QmakeRunConfiguration.UseDyldImageSuffix"};
switch (entry.typeId()) {
- case QVariant::List:
+ case QMetaType::QVariantList:
return Utils::transform(entry.toList(),
std::bind(&UserFileVersion19Upgrader::process, std::placeholders::_1, path));
- case QVariant::Map: {
+ case QMetaType::QVariantMap: {
Store map = storeFromVariant(entry);
Store result;
for (auto it = map.cbegin(), end = map.cend(); it != end; ++it) {
@@ -836,9 +836,9 @@ Store UserFileVersion20Upgrader::upgrade(const Store &map)
QVariant UserFileVersion20Upgrader::process(const QVariant &entry)
{
switch (entry.typeId()) {
- case QVariant::List:
+ case QMetaType::QVariantList:
return Utils::transform(entry.toList(), &UserFileVersion20Upgrader::process);
- case QVariant::Map: {
+ case QMetaType::QVariantMap: {
Store map = storeFromVariant(entry);
Store result;
for (auto it = map.cbegin(), end = map.cend(); it != end; ++it) {
@@ -865,9 +865,9 @@ Store UserFileVersion21Upgrader::upgrade(const Store &map)
QVariant UserFileVersion21Upgrader::process(const QVariant &entry)
{
switch (entry.typeId()) {
- case QVariant::List:
+ case QMetaType::QVariantList:
return Utils::transform(entry.toList(), &UserFileVersion21Upgrader::process);
- case QVariant::Map: {
+ case QMetaType::QVariantMap: {
Store entryMap = storeFromVariant(entry);
if (entryMap.value("ProjectExplorer.ProjectConfiguration.Id").toString()
== "DeployToGenericLinux") {
diff --git a/src/plugins/qbsprojectmanager/qbsprofilemanager.cpp b/src/plugins/qbsprojectmanager/qbsprofilemanager.cpp
index 3cfd68d5ce9..01dd5efb4fe 100644
--- a/src/plugins/qbsprojectmanager/qbsprofilemanager.cpp
+++ b/src/plugins/qbsprojectmanager/qbsprofilemanager.cpp
@@ -60,7 +60,7 @@ QString toJSLiteral(const QVariant &val)
{
if (!val.isValid())
return QString("undefined");
- if (val.typeId() == QVariant::List || val.typeId() == QVariant::StringList) {
+ if (val.typeId() == QMetaType::QVariantList || val.typeId() == QMetaType::QStringList) {
QString res;
const auto list = val.toList();
for (const QVariant &child : list) {
@@ -71,7 +71,7 @@ QString toJSLiteral(const QVariant &val)
res.append(']');
return res;
}
- if (val.typeId() == QVariant::Map) {
+ if (val.typeId() == QMetaType::QVariantMap) {
const QVariantMap &vm = val.toMap();
QString str("{");
for (auto it = vm.begin(); it != vm.end(); ++it) {
@@ -84,7 +84,7 @@ QString toJSLiteral(const QVariant &val)
}
if (val.typeId() == QVariant::Bool)
return toJSLiteral(val.toBool());
- if (val.canConvert(QVariant::String))
+ if (val.canConvert(QMetaType::QString))
return toJSLiteral(val.toString());
return QString::fromLatin1("Unconvertible type %1").arg(QLatin1String(val.typeName()));
}
diff --git a/src/plugins/qmldesigner/components/collectioneditor/datastoremodelnode.cpp b/src/plugins/qmldesigner/components/collectioneditor/datastoremodelnode.cpp
index 5be9c20f9ed..0d7b0976e50 100644
--- a/src/plugins/qmldesigner/components/collectioneditor/datastoremodelnode.cpp
+++ b/src/plugins/qmldesigner/components/collectioneditor/datastoremodelnode.cpp
@@ -493,7 +493,7 @@ void DataStoreModelNode::assignCollectionToNode(AbstractView *view,
const QVariant currentTextRoleValue = textRoleProperty.value();
if (currentTextRoleValue.isValid() && !currentTextRoleValue.isNull()) {
- if (currentTextRoleValue.type() == QVariant::String) {
+ if (currentTextRoleValue.typeId() == QMetaType::QString) {
const QString currentTextRole = currentTextRoleValue.toString();
if (collectionHasColumn(collectionName, currentTextRole))
return;
diff --git a/src/plugins/qmldesigner/components/componentcore/propertycomponentgenerator.cpp b/src/plugins/qmldesigner/components/componentcore/propertycomponentgenerator.cpp
index 8cc84058d20..e7e56e72b98 100644
--- a/src/plugins/qmldesigner/components/componentcore/propertycomponentgenerator.cpp
+++ b/src/plugins/qmldesigner/components/componentcore/propertycomponentgenerator.cpp
@@ -37,7 +37,7 @@ Type getProperty(const QmlJS::SimpleReaderNode *node, const QString &name)
{
if (auto property = node->property(name)) {
const auto &value = property.value;
- if (value.type() == QVariant::List) {
+ if (value.typeId() == QMetaType::QVariantList) {
auto list = value.toList();
if (list.size())
return list.front().value<Type>();
diff --git a/src/plugins/qmldesigner/components/listmodeleditor/listmodeleditormodel.cpp b/src/plugins/qmldesigner/components/listmodeleditor/listmodeleditormodel.cpp
index b6009edc774..6ab97b4307c 100644
--- a/src/plugins/qmldesigner/components/listmodeleditor/listmodeleditormodel.cpp
+++ b/src/plugins/qmldesigner/components/listmodeleditor/listmodeleditormodel.cpp
@@ -32,7 +32,7 @@ public:
if (value.typeId() == QVariant::Bool)
return value;
- if (value.typeId() == QVariant::String) {
+ if (value.typeId() == QMetaType::QString) {
const QString text = value.toString();
if (text == "true")
return QVariant(true);
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
index 70686f31ae9..f731d6803b1 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
@@ -60,10 +60,10 @@ static bool cleverColorCompare(const QVariant &value1, const QVariant &value2)
return c1.name() == c2.name() && c1.alpha() == c2.alpha();
}
- if (value1.typeId() == QVariant::String && value2.typeId() == QVariant::Color)
+ if (value1.typeId() == QMetaType::QString && value2.typeId() == QVariant::Color)
return cleverColorCompare(QVariant(QColor(value1.toString())), value2);
- if (value1.typeId() == QVariant::Color && value2.typeId() == QVariant::String)
+ if (value1.typeId() == QVariant::Color && value2.typeId() == QMetaType::QString)
return cleverColorCompare(value1, QVariant(QColor(value2.toString())));
return false;
diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinesettingsmodel.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinesettingsmodel.cpp
index 39c1f01ce6d..9b85599ead6 100644
--- a/src/plugins/qmldesigner/components/timelineeditor/timelinesettingsmodel.cpp
+++ b/src/plugins/qmldesigner/components/timelineeditor/timelinesettingsmodel.cpp
@@ -68,7 +68,7 @@ TimelineEditorDelegate::TimelineEditorDelegate(QWidget *parent)
if (factory == nullptr) {
factory = new QItemEditorFactory;
QItemEditorCreatorBase *creator = new QItemEditorCreator<QComboBox>("currentText");
- factory->registerEditor(QVariant::String, creator);
+ factory->registerEditor(QMetaType::QString, creator);
}
setItemEditorFactory(factory);
diff --git a/src/plugins/qmldesigner/designercore/metainfo/metainforeader.cpp b/src/plugins/qmldesigner/designercore/metainfo/metainforeader.cpp
index af61ef65735..0addc6884d2 100644
--- a/src/plugins/qmldesigner/designercore/metainfo/metainforeader.cpp
+++ b/src/plugins/qmldesigner/designercore/metainfo/metainforeader.cpp
@@ -272,7 +272,7 @@ inline QString deEscape(const QString &value)
inline QVariant deEscapeVariant(const QVariant &value)
{
- if (value.typeId() == QVariant::String)
+ if (value.typeId() == QMetaType::QString)
return deEscape(value.toString());
return value;
}
diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
index b8c3e610be5..3e9513ae3c7 100644
--- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
+++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
@@ -3504,7 +3504,7 @@ QVariant PropertyMetaInfo::castedValue(const QVariant &value) const
return variant;
} else if (typeId == QVariant::UserType && typeName == "var") {
return variant;
- } else if (variant.typeId() == QVariant::List) {
+ } else if (variant.typeId() == QMetaType::QVariantList) {
// TODO: check the contents of the list
return variant;
} else if (typeName == "var" || typeName == "variant") {
diff --git a/src/plugins/qmldesigner/designercore/model/propertycontainer.cpp b/src/plugins/qmldesigner/designercore/model/propertycontainer.cpp
index cd7cebbb73a..8eaa7947deb 100644
--- a/src/plugins/qmldesigner/designercore/model/propertycontainer.cpp
+++ b/src/plugins/qmldesigner/designercore/model/propertycontainer.cpp
@@ -41,7 +41,7 @@ PropertyName PropertyContainer::name() const
QVariant PropertyContainer::value() const
{
- if (m_value.typeId() == QVariant::String)
+ if (m_value.typeId() == QMetaType::QString)
m_value = PropertyParser::read(m_type, m_value.toString());
return m_value;
}
diff --git a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp
index 17d40daca3e..88a3de7e094 100644
--- a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp
+++ b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp
@@ -593,7 +593,7 @@ QString RewriterView::auxiliaryDataAsQML() const
hasAuxData = true;
QString strValue = value.toString();
- auto metaType = static_cast<QMetaType::Type>(value.type());
+ const int metaType = value.typeId();
if (metaType == QMetaType::QString
|| metaType == QMetaType::QColor) {
diff --git a/src/plugins/qmldesigner/designercore/projectstorage/typeannotationreader.cpp b/src/plugins/qmldesigner/designercore/projectstorage/typeannotationreader.cpp
index 67a63542bcb..e283d849a47 100644
--- a/src/plugins/qmldesigner/designercore/projectstorage/typeannotationreader.cpp
+++ b/src/plugins/qmldesigner/designercore/projectstorage/typeannotationreader.cpp
@@ -304,7 +304,7 @@ QString deEscape(const QString &value)
QVariant deEscapeVariant(const QVariant &value)
{
- if (value.typeId() == QVariant::String)
+ if (value.typeId() == QMetaType::QString)
return deEscape(value.toString());
return value;
}
@@ -459,9 +459,9 @@ using json = nlohmann::json;
out = json::array({});
out.push_back(property.name);
out.push_back(property.type);
- if (property.value.type() == QVariant::String)
+ if (property.value.typeId() == QMetaType::QString)
out.push_back(Utils::PathString{property.value.toString()});
- else if (property.value.type() == QVariant::Int || property.value.type() == QVariant::LongLong)
+ else if (property.value.typeId() == QMetaType::Int || property.value.typeId() == QMetaType::LongLong)
out.push_back(property.value.toLongLong());
else
out.push_back(property.value.toDouble());
diff --git a/src/plugins/scxmleditor/plugin_interface/scattributeitemdelegate.cpp b/src/plugins/scxmleditor/plugin_interface/scattributeitemdelegate.cpp
index fa735e5d687..0121ddf191a 100644
--- a/src/plugins/scxmleditor/plugin_interface/scattributeitemdelegate.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/scattributeitemdelegate.cpp
@@ -19,12 +19,12 @@ QWidget *SCAttributeItemDelegate::createEditor(QWidget *parent, const QStyleOpti
Q_UNUSED(option)
switch (index.data(DataTypeRole).toInt()) {
- case QVariant::StringList: {
+ case QMetaType::QStringList: {
auto combo = new QComboBox(parent);
combo->setFocusPolicy(Qt::StrongFocus);
return combo;
}
- case QVariant::String: {
+ case QMetaType::QString: {
if (index.column() == 0) {
auto edit = new QLineEdit(parent);
edit->setFocusPolicy(Qt::StrongFocus);
@@ -52,7 +52,7 @@ void SCAttributeItemDelegate::updateEditorGeometry(QWidget *editor, const QStyle
void SCAttributeItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
switch (index.data(DataTypeRole).toInt()) {
- case QVariant::StringList: {
+ case QMetaType::QStringList: {
auto combo = qobject_cast<QComboBox*>(editor);
if (combo) {
combo->clear();
diff --git a/src/plugins/scxmleditor/plugin_interface/scattributeitemmodel.cpp b/src/plugins/scxmleditor/plugin_interface/scattributeitemmodel.cpp
index 454af2930f1..c759bcca73e 100644
--- a/src/plugins/scxmleditor/plugin_interface/scattributeitemmodel.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/scattributeitemmodel.cpp
@@ -84,7 +84,7 @@ QVariant SCAttributeItemModel::data(const QModelIndex &index, int role) const
}
} else {
if (bEditable) {
- if (m_tag->tagType() > MetadataItem && m_tag->info()->attributes[index.row()].datatype == QVariant::StringList)
+ if (m_tag->tagType() > MetadataItem && m_tag->info()->attributes[index.row()].datatype == QMetaType::QStringList)
return QString::fromLatin1(m_tag->info()->attributes[index.row()].value).split(";");
else
return m_tag->attribute(index.row());
@@ -100,11 +100,11 @@ QVariant SCAttributeItemModel::data(const QModelIndex &index, int role) const
break;
case DataTypeRole: {
if (m_tag->tagType() == Metadata || m_tag->tagType() == MetadataItem)
- return (int)QVariant::String;
+ return (int)QMetaType::QString;
else if (index.column() == 1 && m_tag->info()->n_attributes > 0)
return m_tag->info()->attributes[index.row()].datatype;
else
- return QVariant::Invalid;
+ return {};
}
case DataRole: {
if (m_tag->info()->n_attributes > 0)
diff --git a/src/plugins/scxmleditor/plugin_interface/scxmltypes.h b/src/plugins/scxmleditor/plugin_interface/scxmltypes.h
index 62fe00528ab..0224fb8cb29 100644
--- a/src/plugins/scxmleditor/plugin_interface/scxmltypes.h
+++ b/src/plugins/scxmleditor/plugin_interface/scxmltypes.h
@@ -65,119 +65,119 @@ struct scxmltag_type_t
// Define tag-attributes
const scxmltag_attribute_t scxml_scxml_attributes[] = {
- {"initial", nullptr, false, false, QVariant::String},
- {"name", nullptr, false, true, QVariant::String},
- {"xmlns", "http://www.w3.org/2005/07/scxml", true, false, QVariant::String},
- {"version", "1.0", true, false, QVariant::String},
- {"datamodel", nullptr, false, true, QVariant::String},
- {"binding", "early;late", false, true, QVariant::StringList}
+ {"initial", nullptr, false, false, QMetaType::QString},
+ {"name", nullptr, false, true, QMetaType::QString},
+ {"xmlns", "http://www.w3.org/2005/07/scxml", true, false, QMetaType::QString},
+ {"version", "1.0", true, false, QMetaType::QString},
+ {"datamodel", nullptr, false, true, QMetaType::QString},
+ {"binding", "early;late", false, true, QMetaType::QStringList}
};
const scxmltag_attribute_t scxml_state_attributes[] = {
- {"id", nullptr, false, true, QVariant::String},
- {"initial", nullptr, false, false, QVariant::String}
+ {"id", nullptr, false, true, QMetaType::QString},
+ {"initial", nullptr, false, false, QMetaType::QString}
};
const scxmltag_attribute_t scxml_parallel_attributes[] = {
- {"id", nullptr, false, true, QVariant::String}
+ {"id", nullptr, false, true, QMetaType::QString}
};
const scxmltag_attribute_t scxml_transition_attributes[] = {
- {"event", nullptr, false, true, QVariant::String},
- {"cond", nullptr, false, true, QVariant::String},
- {"target", nullptr, false, true, QVariant::String},
- {"type", "internal;external", false, true, QVariant::StringList}
+ {"event", nullptr, false, true, QMetaType::QString},
+ {"cond", nullptr, false, true, QMetaType::QString},
+ {"target", nullptr, false, true, QMetaType::QString},
+ {"type", "internal;external", false, true, QMetaType::QStringList}
};
const scxmltag_attribute_t scxml_initialtransition_attributes[] = {
- {"target", nullptr, false, false, QVariant::String}
+ {"target", nullptr, false, false, QMetaType::QString}
};
const scxmltag_attribute_t scxml_final_attributes[] = {
- {"id", nullptr, false, true, QVariant::String}
+ {"id", nullptr, false, true, QMetaType::QString}
};
const scxmltag_attribute_t scxml_history_attributes[] = {
- {"id", nullptr, false, true, QVariant::String},
- {"type", "shallow;deep", false, true, QVariant::StringList}
+ {"id", nullptr, false, true, QMetaType::QString},
+ {"type", "shallow;deep", false, true, QMetaType::QStringList}
};
const scxmltag_attribute_t scxml_raise_attributes[] = {
- {"event", nullptr, true, true, QVariant::String}
+ {"event", nullptr, true, true, QMetaType::QString}
};
const scxmltag_attribute_t scxml_if_attributes[] = {
- {"cond", nullptr, true, true, QVariant::String},
+ {"cond", nullptr, true, true, QMetaType::QString},
};
const scxmltag_attribute_t scxml_elseif_attributes[] = {
- {"cond", nullptr, true, true, QVariant::String}
+ {"cond", nullptr, true, true, QMetaType::QString}
};
const scxmltag_attribute_t scxml_foreach_attributes[] = {
- {"array", nullptr, true, true, QVariant::String},
- {"item", nullptr, true, true, QVariant::String},
- {"index", nullptr, false, true, QVariant::String}
+ {"array", nullptr, true, true, QMetaType::QString},
+ {"item", nullptr, true, true, QMetaType::QString},
+ {"index", nullptr, false, true, QMetaType::QString}
};
const scxmltag_attribute_t scxml_log_attributes[] = {
- {"label", "", false, true, QVariant::String},
- {"expr", nullptr, false, true, QVariant::String}
+ {"label", "", false, true, QMetaType::QString},
+ {"expr", nullptr, false, true, QMetaType::QString}
};
const scxmltag_attribute_t scxml_data_attributes[] = {
- {"id", nullptr, true, true, QVariant::String},
- {"src", nullptr, false, true, QVariant::String},
- {"expr", nullptr, false, true, QVariant::String}
+ {"id", nullptr, true, true, QMetaType::QString},
+ {"src", nullptr, false, true, QMetaType::QString},
+ {"expr", nullptr, false, true, QMetaType::QString}
};
const scxmltag_attribute_t scxml_assign_attributes[] = {
- {"location", nullptr, true, true, QVariant::String},
- {"expr", nullptr, false, true, QVariant::String}
+ {"location", nullptr, true, true, QMetaType::QString},
+ {"expr", nullptr, false, true, QMetaType::QString}
};
const scxmltag_attribute_t scxml_content_attributes[] = {
- {"expr", nullptr, false, true, QVariant::String}
+ {"expr", nullptr, false, true, QMetaType::QString}
};
const scxmltag_attribute_t scxml_param_attributes[] = {
- {"name", nullptr, true, true, QVariant::String},
- {"expr", nullptr, false, true, QVariant::String},
- {"location", nullptr, false, true, QVariant::String}
+ {"name", nullptr, true, true, QMetaType::QString},
+ {"expr", nullptr, false, true, QMetaType::QString},
+ {"location", nullptr, false, true, QMetaType::QString}
};
const scxmltag_attribute_t scxml_script_attributes[] = {
- {"src", nullptr, false, true, QVariant::String}
+ {"src", nullptr, false, true, QMetaType::QString}
};
const scxmltag_attribute_t scxml_send_attributes[] = {
- {"event", nullptr, false, true, QVariant::String},
- {"eventexpr", nullptr, false, true, QVariant::String},
- {"target", nullptr, false, true, QVariant::String},
- {"targetexpr", nullptr, false, true, QVariant::String},
- {"type", nullptr, false, true, QVariant::String},
- {"typeexpr", nullptr, false, true, QVariant::String},
- {"id", nullptr, false, true, QVariant::String},
- {"idlocation", nullptr, false, true, QVariant::String},
- {"delay", nullptr, false, true, QVariant::String},
- {"delayexpr", nullptr, false, true, QVariant::String},
- {"namelist", nullptr, false, true, QVariant::String}
+ {"event", nullptr, false, true, QMetaType::QString},
+ {"eventexpr", nullptr, false, true, QMetaType::QString},
+ {"target", nullptr, false, true, QMetaType::QString},
+ {"targetexpr", nullptr, false, true, QMetaType::QString},
+ {"type", nullptr, false, true, QMetaType::QString},
+ {"typeexpr", nullptr, false, true, QMetaType::QString},
+ {"id", nullptr, false, true, QMetaType::QString},
+ {"idlocation", nullptr, false, true, QMetaType::QString},
+ {"delay", nullptr, false, true, QMetaType::QString},
+ {"delayexpr", nullptr, false, true, QMetaType::QString},
+ {"namelist", nullptr, false, true, QMetaType::QString}
};
const scxmltag_attribute_t scxml_cancel_attributes[] = {
- {"sendid", nullptr, false, true, QVariant::String},
- {"sendidexpr", nullptr, false, true, QVariant::String}
+ {"sendid", nullptr, false, true, QMetaType::QString},
+ {"sendidexpr", nullptr, false, true, QMetaType::QString}
};
const scxmltag_attribute_t scxml_invoke_attributes[] = {
- {"type", nullptr, false, true, QVariant::String},
- {"typeexpr", nullptr, false, true, QVariant::String},
- {"src", nullptr, false, true, QVariant::String},
- {"srcexpr", nullptr, false, true, QVariant::String},
- {"id", nullptr, false, true, QVariant::String},
- {"idlocation", nullptr, false, true, QVariant::String},
- {"namelist", nullptr, false, true, QVariant::String},
- {"autoforward", ";true;false", false, true, QVariant::StringList}
+ {"type", nullptr, false, true, QMetaType::QString},
+ {"typeexpr", nullptr, false, true, QMetaType::QString},
+ {"src", nullptr, false, true, QMetaType::QString},
+ {"srcexpr", nullptr, false, true, QMetaType::QString},
+ {"id", nullptr, false, true, QMetaType::QString},
+ {"idlocation", nullptr, false, true, QMetaType::QString},
+ {"namelist", nullptr, false, true, QMetaType::QString},
+ {"autoforward", ";true;false", false, true, QMetaType::QStringList}
};
const scxmltag_type_t scxml_unknown = {
diff --git a/src/plugins/squish/squishwizardpages.cpp b/src/plugins/squish/squishwizardpages.cpp
index 0ee6dab6b2c..707421c4134 100644
--- a/src/plugins/squish/squishwizardpages.cpp
+++ b/src/plugins/squish/squishwizardpages.cpp
@@ -319,7 +319,7 @@ bool SquishFileGenerator::setup(const QVariant &data, QString *errorMessage)
if (data.isNull())
return false;
- if (data.typeId() != QVariant::Map) {
+ if (data.typeId() != QMetaType::QVariantMap) {
*errorMessage = Tr::tr("Key is not an object.");
return false;
}
diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp
index 462412df06d..5105be5430c 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.cpp
+++ b/src/plugins/vcsbase/vcsbaseeditor.cpp
@@ -1638,7 +1638,7 @@ IEditor *VcsBaseEditor::locateEditorByTag(const QString &tag)
const QList<IDocument *> documents = DocumentModel::openedDocuments();
for (IDocument *document : documents) {
const QVariant tagPropertyValue = document->property(tagPropertyC);
- if (tagPropertyValue.type() == QVariant::String && tagPropertyValue.toString() == tag)
+ if (tagPropertyValue.typeId() == QMetaType::QString && tagPropertyValue.toString() == tag)
return DocumentModel::editorsForDocument(document).constFirst();
}
return nullptr;
diff --git a/src/plugins/vcsbase/wizard/vcscommandpage.cpp b/src/plugins/vcsbase/wizard/vcscommandpage.cpp
index c24cdfce0eb..ab594526887 100644
--- a/src/plugins/vcsbase/wizard/vcscommandpage.cpp
+++ b/src/plugins/vcsbase/wizard/vcscommandpage.cpp
@@ -72,9 +72,9 @@ WizardPage *VcsCommandPageFactory::create(JsonWizard *wizard, Id typeId, const Q
QStringList args;
const QVariant argsVar = tmp.value(QLatin1String(VCSCOMMAND_EXTRA_ARGS));
if (!argsVar.isNull()) {
- if (argsVar.type() == QVariant::String) {
+ if (argsVar.typeId() == QMetaType::QString) {
args << argsVar.toString();
- } else if (argsVar.type() == QVariant::List) {
+ } else if (argsVar.typeId() == QMetaType::QVariantList) {
args = Utils::transform(argsVar.toList(), &QVariant::toString);
} else {
return nullptr;
@@ -101,7 +101,7 @@ WizardPage *VcsCommandPageFactory::create(JsonWizard *wizard, Id typeId, const Q
const QVariant &jobArgVar = job.value(QLatin1String(JOB_ARGUMENTS));
QStringList jobArgs;
if (!jobArgVar.isNull()) {
- if (jobArgVar.type() == QVariant::List)
+ if (jobArgVar.typeId() == QMetaType::QVariantList)
jobArgs = Utils::transform(jobArgVar.toList(), &QVariant::toString);
else
jobArgs << jobArgVar.toString();
@@ -127,7 +127,7 @@ bool VcsCommandPageFactory::validateData(Id typeId, const QVariant &data, QStrin
QTC_ASSERT(canCreate(typeId), return false);
QString em;
- if (data.type() != QVariant::Map)
+ if (data.typeId() != QMetaType::QVariantMap)
em = Tr::tr("\"data\" is no JSON object in \"VcsCommand\" page.");
if (em.isEmpty()) {
@@ -161,13 +161,13 @@ bool VcsCommandPageFactory::validateData(Id typeId, const QVariant &data, QStrin
}
const QVariant extra = tmp.value(QLatin1String(VCSCOMMAND_EXTRA_ARGS));
- if (!extra.isNull() && extra.type() != QVariant::String && extra.type() != QVariant::List) {
+ if (!extra.isNull() && extra.typeId() != QMetaType::QString && extra.typeId() != QMetaType::QVariantList) {
em = Tr::tr("\"%1\" in \"data\" section of \"VcsCommand\" page has unexpected type (unset, String or List).")
.arg(QLatin1String(VCSCOMMAND_EXTRA_ARGS));
}
const QVariant jobs = tmp.value(QLatin1String(VCSCOMMAND_JOBS));
- if (!jobs.isNull() && extra.type() != QVariant::List) {
+ if (!jobs.isNull() && extra.typeId() != QMetaType::QVariantList) {
em = Tr::tr("\"%1\" in \"data\" section of \"VcsCommand\" page has unexpected type (unset or List).")
.arg(QLatin1String(VCSCOMMAND_JOBS));
}
@@ -178,7 +178,7 @@ bool VcsCommandPageFactory::validateData(Id typeId, const QVariant &data, QStrin
em = Tr::tr("Job in \"VcsCommand\" page is empty.");
break;
}
- if (j.type() != QVariant::Map) {
+ if (j.typeId() != QMetaType::QVariantMap) {
em = Tr::tr("Job in \"VcsCommand\" page is not an object.");
break;
}
diff --git a/src/plugins/vcsbase/wizard/vcsconfigurationpage.cpp b/src/plugins/vcsbase/wizard/vcsconfigurationpage.cpp
index 2de42975635..0a591be6959 100644
--- a/src/plugins/vcsbase/wizard/vcsconfigurationpage.cpp
+++ b/src/plugins/vcsbase/wizard/vcsconfigurationpage.cpp
@@ -56,7 +56,7 @@ bool VcsConfigurationPageFactory::validateData(Id typeId, const QVariant &data,
{
QTC_ASSERT(canCreate(typeId), return false);
- if (data.isNull() || data.type() != QVariant::Map) {
+ if (data.isNull() || data.typeId() != QMetaType::QVariantMap) {
//: Do not translate "VcsConfiguration", because it is the id of a page.
*errorMessage = ProjectExplorer::Tr::tr("\"data\" must be a JSON object for \"VcsConfiguration\" pages.");
return false;
diff --git a/src/tools/qml2puppet/qml2puppet/instances/objectnodeinstance.cpp b/src/tools/qml2puppet/qml2puppet/instances/objectnodeinstance.cpp
index a1c727f215b..813619d8167 100644
--- a/src/tools/qml2puppet/qml2puppet/instances/objectnodeinstance.cpp
+++ b/src/tools/qml2puppet/qml2puppet/instances/objectnodeinstance.cpp
@@ -372,7 +372,7 @@ void ObjectNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParentIn
QVariant ObjectNodeInstance::convertSpecialCharacter(const QVariant& value) const
{
QVariant specialCharacterConvertedValue = value;
- if (value.typeId() == QVariant::String) {
+ if (value.typeId() == QMetaType::QString) {
QString string = value.toString();
string.replace(QLatin1String("\\n"), QLatin1String("\n"));
string.replace(QLatin1String("\\t"), QLatin1String("\t"));
diff --git a/src/tools/qml2puppet/qmlprivategate/qmlprivategate.cpp b/src/tools/qml2puppet/qmlprivategate/qmlprivategate.cpp
index 096ac362441..6897a23973b 100644
--- a/src/tools/qml2puppet/qmlprivategate/qmlprivategate.cpp
+++ b/src/tools/qml2puppet/qmlprivategate/qmlprivategate.cpp
@@ -604,7 +604,7 @@ static QString qmlDesignerRCPath()
QVariant fixResourcePaths(const QVariant &value)
{
- if (value.typeId() == QVariant::Url) {
+ if (value.typeId() == QMetaType::QUrl) {
const QUrl url = value.toUrl();
if (url.scheme() == QLatin1String("qrc")) {
const QString path = QLatin1String("qrc:") + url.path();
@@ -625,7 +625,7 @@ QVariant fixResourcePaths(const QVariant &value)
}
}
}
- if (value.typeId() == QVariant::String) {
+ if (value.typeId() == QMetaType::QString) {
const QString str = value.toString();
if (str.contains(QLatin1String("qrc:"))) {
if (!qmlDesignerRCPath().isEmpty()) {
diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp
index 569d0ce3a4e..bd7071f054c 100644
--- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp
+++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp
@@ -698,17 +698,17 @@ void tst_TestCore::testRewriterDynamicProperties()
QCOMPARE(rootModelNode.properties().count(), 18);
QVERIFY(rootModelNode.hasVariantProperty("i"));
QCOMPARE(rootModelNode.variantProperty("i").dynamicTypeName(), QmlDesigner::TypeName("int"));
- QCOMPARE(rootModelNode.variantProperty("i").value().type(), QVariant::Int);
+ QCOMPARE(rootModelNode.variantProperty("i").value().typeId(), QMetaType::Int);
QCOMPARE(testRewriterView1->rootModelNode().variantProperty("i").value().toInt(), 0);
QVERIFY(rootModelNode.hasVariantProperty("ii"));
QCOMPARE(rootModelNode.variantProperty("ii").dynamicTypeName(), QmlDesigner::TypeName("int"));
- QCOMPARE(rootModelNode.variantProperty("ii").value().type(), QVariant::Int);
+ QCOMPARE(rootModelNode.variantProperty("ii").value().typeId(), QMetaType::Int);
QCOMPARE(testRewriterView1->rootModelNode().variantProperty("ii").value().toInt(), 1);
QVERIFY(rootModelNode.hasVariantProperty("b"));
QCOMPARE(rootModelNode.variantProperty("b").dynamicTypeName(), QmlDesigner::TypeName("bool"));
- QCOMPARE(rootModelNode.variantProperty("b").value().type(), QVariant::Bool);
+ QCOMPARE(rootModelNode.variantProperty("b").value().typeId(), QMetaType::Bool);
QCOMPARE(testRewriterView1->rootModelNode().variantProperty("b").value().toBool(), false);
QVERIFY(rootModelNode.hasVariantProperty("bb"));
@@ -716,7 +716,7 @@ void tst_TestCore::testRewriterDynamicProperties()
QVERIFY(rootModelNode.hasVariantProperty("d"));
QCOMPARE(rootModelNode.variantProperty("d").dynamicTypeName(), QmlDesigner::TypeName("double"));
- QCOMPARE(rootModelNode.variantProperty("d").value().type(), QVariant::Double);
+ QCOMPARE(rootModelNode.variantProperty("d").value().typeId(), QMetaType::Double);
QCOMPARE(testRewriterView1->rootModelNode().variantProperty("d").value().toDouble(), 0.0);
QVERIFY(rootModelNode.hasVariantProperty("dd"));
@@ -724,7 +724,7 @@ void tst_TestCore::testRewriterDynamicProperties()
QVERIFY(rootModelNode.hasVariantProperty("r"));
QCOMPARE(rootModelNode.variantProperty("r").dynamicTypeName(), QmlDesigner::TypeName("real"));
- QCOMPARE(rootModelNode.variantProperty("r").value().type(), QVariant::Double);
+ QCOMPARE(rootModelNode.variantProperty("r").value().typeId(), QMetaType::Double);
QCOMPARE(testRewriterView1->rootModelNode().variantProperty("r").value().toDouble(), 0.0);
QVERIFY(rootModelNode.hasVariantProperty("rr"));
@@ -732,7 +732,7 @@ void tst_TestCore::testRewriterDynamicProperties()
QVERIFY(rootModelNode.hasVariantProperty("s"));
QCOMPARE(rootModelNode.variantProperty("s").dynamicTypeName(), QmlDesigner::TypeName("string"));
- QCOMPARE(rootModelNode.variantProperty("s").value().type(), QVariant::String);
+ QCOMPARE(rootModelNode.variantProperty("s").value().typeId(), QMetaType::QString);
QCOMPARE(testRewriterView1->rootModelNode().variantProperty("s").value().toString(), QString());
QVERIFY(rootModelNode.hasVariantProperty("ss"));
@@ -740,7 +740,7 @@ void tst_TestCore::testRewriterDynamicProperties()
QVERIFY(rootModelNode.hasVariantProperty("u"));
QCOMPARE(rootModelNode.variantProperty("u").dynamicTypeName(), QmlDesigner::TypeName("url"));
- QCOMPARE(rootModelNode.variantProperty("u").value().type(), QVariant::Url);
+ QCOMPARE(rootModelNode.variantProperty("u").value().typeId(), QMetaType::QUrl);
QCOMPARE(testRewriterView1->rootModelNode().variantProperty("u").value().toUrl(), QUrl());
QVERIFY(rootModelNode.hasVariantProperty("uu"));
@@ -748,7 +748,7 @@ void tst_TestCore::testRewriterDynamicProperties()
QVERIFY(rootModelNode.hasVariantProperty("c"));
QCOMPARE(rootModelNode.variantProperty("c").dynamicTypeName(), QmlDesigner::TypeName("color"));
- QCOMPARE(rootModelNode.variantProperty("c").value().type(), QVariant::Color);
+ QCOMPARE(rootModelNode.variantProperty("c").value().typeId(), QMetaType::QColor);
QCOMPARE(testRewriterView1->rootModelNode().variantProperty("c").value().value<QColor>(), QColor());
QVERIFY(rootModelNode.hasVariantProperty("cc"));
@@ -756,7 +756,7 @@ void tst_TestCore::testRewriterDynamicProperties()
QVERIFY(rootModelNode.hasVariantProperty("t"));
QCOMPARE(rootModelNode.variantProperty("t").dynamicTypeName(), QmlDesigner::TypeName("date"));
- QCOMPARE(rootModelNode.variantProperty("t").value().type(), QVariant::Date);
+ QCOMPARE(rootModelNode.variantProperty("t").value().typeId(), QMetaType::QDate);
QCOMPARE(testRewriterView1->rootModelNode().variantProperty("t").value().value<QDate>(), QDate());
QVERIFY(rootModelNode.hasVariantProperty("tt"));
@@ -764,8 +764,8 @@ void tst_TestCore::testRewriterDynamicProperties()
QVERIFY(rootModelNode.hasVariantProperty("v"));
QCOMPARE(rootModelNode.variantProperty("v").dynamicTypeName(), QmlDesigner::TypeName("variant"));
- const int type = rootModelNode.variantProperty("v").value().type();
- QCOMPARE(type, QMetaType::type("QVariant"));
+ const int type = rootModelNode.variantProperty("v").value().typeId();
+ QCOMPARE(type, QMetaType::fromName("QVariant").id());
QVERIFY(rootModelNode.hasVariantProperty("vv"));
const QString inThere = testRewriterView1->rootModelNode().variantProperty("vv").value().value<QString>();
@@ -3872,8 +3872,8 @@ void tst_TestCore::testRewriterPreserveType()
QCOMPARE(rootNode.type(), QmlDesigner::TypeName("QtQuick.Rectangle"));
ModelNode textNode = rootNode.directSubModelNodes().first();
- QCOMPARE(QVariant::Bool, textNode.variantProperty("font.bold").value().type());
- QCOMPARE(QVariant::Double, textNode.variantProperty("font.pointSize").value().type());
+ QCOMPARE(QMetaType::Bool, textNode.variantProperty("font.bold").value().typeId());
+ QCOMPARE(QMetaType::Double, textNode.variantProperty("font.pointSize").value().typeId());
textNode.variantProperty("font.bold").setValue(QVariant(false));
textNode.variantProperty("font.bold").setValue(QVariant(true));
textNode.variantProperty("font.pointSize").setValue(QVariant(13.0));
@@ -3883,8 +3883,8 @@ void tst_TestCore::testRewriterPreserveType()
newTextNode.variantProperty("font.bold").setValue(QVariant(true));
newTextNode.variantProperty("font.pointSize").setValue(QVariant(13.0));
- QCOMPARE(QVariant::Bool, newTextNode.variantProperty("font.bold").value().type());
- QCOMPARE(QVariant::Double, newTextNode.variantProperty("font.pointSize").value().type());
+ QCOMPARE(QMetaType::Bool, newTextNode.variantProperty("font.bold").value().typeId());
+ QCOMPARE(QMetaType::Double, newTextNode.variantProperty("font.pointSize").value().typeId());
}
void tst_TestCore::testRewriterForArrayMagic()
@@ -6957,9 +6957,9 @@ void tst_TestCore::testModelPropertyValueTypes()
ModelNode rootModelNode(testRewriterView1->rootModelNode());
QVERIFY(rootModelNode.isValid());
- QCOMPARE(rootModelNode.variantProperty("width").value().type(), QVariant::Double);
- QCOMPARE(rootModelNode.variantProperty("radius").value().type(), QVariant::Double);
- QCOMPARE(rootModelNode.variantProperty("color").value().type(), QVariant::Color);
+ QCOMPARE(rootModelNode.variantProperty("width").value().typeId(), QMetaType::Double);
+ QCOMPARE(rootModelNode.variantProperty("radius").value().typeId(), QMetaType::Double);
+ QCOMPARE(rootModelNode.variantProperty("color").value().typeId(), QMetaType::QColor);
}
void tst_TestCore::testModelNodeInHierarchy()
@@ -8963,18 +8963,18 @@ void tst_TestCore::loadGradient()
QCOMPARE(pOne.id(), QString("pOne"));
QCOMPARE(pOne.directSubModelNodes().size(), 0);
QCOMPARE(pOne.propertyNames().size(), 2);
- QCOMPARE(pOne.variantProperty("position").value().type(), QVariant::Double);
+ QCOMPARE(pOne.variantProperty("position").value().typeId(), QMetaType::Double);
QCOMPARE(pOne.variantProperty("position").value().toDouble(), 0.0);
- QCOMPARE(pOne.variantProperty("color").value().type(), QVariant::Color);
+ QCOMPARE(pOne.variantProperty("color").value().typeId(), QMetaType::QColor);
QCOMPARE(pOne.variantProperty("color").value().value<QColor>(), QColor("lightsteelblue"));
QCOMPARE(pTwo.type(), QmlDesigner::TypeName("QtQuick.GradientStop"));
QCOMPARE(pTwo.id(), QString("pTwo"));
QCOMPARE(pTwo.directSubModelNodes().size(), 0);
QCOMPARE(pTwo.propertyNames().size(), 2);
- QCOMPARE(pTwo.variantProperty("position").value().type(), QVariant::Double);
+ QCOMPARE(pTwo.variantProperty("position").value().typeId(), QMetaType::Double);
QCOMPARE(pTwo.variantProperty("position").value().toDouble(), 1.0);
- QCOMPARE(pTwo.variantProperty("color").value().type(), QVariant::Color);
+ QCOMPARE(pTwo.variantProperty("color").value().typeId(), QMetaType::QColor);
QCOMPARE(pTwo.variantProperty("color").value().value<QColor>(), QColor("blue"));
}
@@ -9003,18 +9003,18 @@ void tst_TestCore::loadGradient()
QCOMPARE(nOne.id(), QString("nOne"));
QCOMPARE(nOne.directSubModelNodes().size(), 0);
QCOMPARE(nOne.propertyNames().size(), 2);
- QCOMPARE(nOne.variantProperty("position").value().type(), QVariant::Double);
+ QCOMPARE(nOne.variantProperty("position").value().typeId(), QMetaType::Double);
QCOMPARE(nOne.variantProperty("position").value().toDouble(), 0.0);
- QCOMPARE(nOne.variantProperty("color").value().type(), QVariant::Color);
+ QCOMPARE(nOne.variantProperty("color").value().typeId(), QMetaType::QColor);
QCOMPARE(nOne.variantProperty("color").value().value<QColor>(), QColor("blue"));
QCOMPARE(nTwo.type(), QmlDesigner::TypeName("QtQuick.GradientStop"));
QCOMPARE(nTwo.id(), QString("nTwo"));
QCOMPARE(nTwo.directSubModelNodes().size(), 0);
QCOMPARE(nTwo.propertyNames().size(), 2);
- QCOMPARE(nTwo.variantProperty("position").value().type(), QVariant::Double);
+ QCOMPARE(nTwo.variantProperty("position").value().typeId(), QMetaType::Double);
QCOMPARE(nTwo.variantProperty("position").value().toDouble(), 1.0);
- QCOMPARE(nTwo.variantProperty("color").value().type(), QVariant::Color);
+ QCOMPARE(nTwo.variantProperty("color").value().typeId(), QMetaType::QColor);
QCOMPARE(nTwo.variantProperty("color").value().value<QColor>(), QColor("lightsteelblue"));
}
}
diff --git a/tests/auto/utils/persistentsettings/tst_persistentsettings.cpp b/tests/auto/utils/persistentsettings/tst_persistentsettings.cpp
index e2fde299096..9890545a7ef 100644
--- a/tests/auto/utils/persistentsettings/tst_persistentsettings.cpp
+++ b/tests/auto/utils/persistentsettings/tst_persistentsettings.cpp
@@ -61,18 +61,18 @@ void PersistentSettingsTest::tst_readwrite()
auto found = restored.find(it.key());
QVERIFY(found != restoredEnd);
QVERIFY(found.value().isValid());
- if (it.value().type() == QVariant::List) {
+ if (it.value().typeId() == QMetaType::QVariantList) {
const QVariantList origList = it.value().toList();
const QVariantList foundList = found.value().toList();
QCOMPARE(foundList.size(), origList.size());
for (int i = 0, vEnd = foundList.size(); i < vEnd; ++i) {
- if (foundList.at(i).type() == QVariant::Rect)
+ if (foundList.at(i).typeId() == QMetaType::QRect)
qDebug() << foundList.at(i).toRect() << origList.at(i).toRect();
QCOMPARE(foundList.at(i), origList.at(i));
}
}
- if (it.value().type() == QVariant::Rect)
+ if (it.value().typeId() == QMetaType::QRect)
qDebug() << found.value().toRect() << "vs" << it.value().toRect();
QCOMPARE(found.value(), it.value());
}
diff --git a/tests/unit/tests/unittests/componentcore/propertycomponentgenerator-test.cpp b/tests/unit/tests/unittests/componentcore/propertycomponentgenerator-test.cpp
index 10e4cc32525..557d45e6940 100644
--- a/tests/unit/tests/unittests/componentcore/propertycomponentgenerator-test.cpp
+++ b/tests/unit/tests/unittests/componentcore/propertycomponentgenerator-test.cpp
@@ -74,7 +74,7 @@ protected:
{
if (auto property = node->property(name)) {
const auto &value = property.value;
- if (value.type() == QVariant::List) {
+ if (value.typeId() == QMetaType::QVariantList) {
auto list = value.toList();
if (list.size())
return list.front().value<Type>();
diff --git a/tests/unit/tests/unittests/listmodeleditor/listmodeleditor-test.cpp b/tests/unit/tests/unittests/listmodeleditor/listmodeleditor-test.cpp
index f8bef106acf..06ab4f930cd 100644
--- a/tests/unit/tests/unittests/listmodeleditor/listmodeleditor-test.cpp
+++ b/tests/unit/tests/unittests/listmodeleditor/listmodeleditor-test.cpp
@@ -511,7 +511,7 @@ TEST_F(ListModelEditor, convert_string_float_to_float)
model.setValue(1, 1, "25.5");
ASSERT_THAT(element2.variantProperty("name").value().value<double>(), 25.5);
- ASSERT_THAT(element2.variantProperty("name").value().type(), QVariant::Double);
+ ASSERT_THAT(element2.variantProperty("name").value().typeId(), QMetaType::Double);
}
TEST_F(ListModelEditor, convert_string_integer_to_double)
@@ -521,7 +521,7 @@ TEST_F(ListModelEditor, convert_string_integer_to_double)
model.setValue(1, 1, "25");
ASSERT_THAT(element2.variantProperty("name").value().value<double>(), 25);
- ASSERT_THAT(element2.variantProperty("name").value().type(), QVariant::Double);
+ ASSERT_THAT(element2.variantProperty("name").value().typeId(), QMetaType::Double);
}
TEST_F(ListModelEditor, dont_convert_string_to_number)
@@ -531,7 +531,7 @@ TEST_F(ListModelEditor, dont_convert_string_to_number)
model.setValue(1, 1, "hello");
ASSERT_THAT(element2.variantProperty("name").value().value<QString>(), u"hello");
- ASSERT_THAT(element2.variantProperty("name").value().type(), QVariant::String);
+ ASSERT_THAT(element2.variantProperty("name").value().typeId(), QMetaType::QString);
}
TEST_F(ListModelEditor, empty_strings_removes_property)
@@ -558,7 +558,7 @@ TEST_F(ListModelEditor, dispay_value_is_changed_to_double)
model.setValue(1, 1, "25.5");
- ASSERT_THAT(displayValues()[1][1].type(), QVariant::Double);
+ ASSERT_THAT(displayValues()[1][1].typeId(), QMetaType::Double);
}
TEST_F(ListModelEditor, string_dispay_value_is_not_changed)
@@ -567,7 +567,7 @@ TEST_F(ListModelEditor, string_dispay_value_is_not_changed)
model.setValue(1, 1, "25.5a");
- ASSERT_THAT(displayValues()[1][1].type(), QVariant::String);
+ ASSERT_THAT(displayValues()[1][1].typeId(), QMetaType::QString);
}
TEST_F(ListModelEditor, set_invalid_to_dark_yellow_background_color)