forked from qt-creator/qt-creator
ProjectExplorer: Handle more Qt deprecation warnings
Change-Id: I6b6c24e17fce369324749a47ae2aa8a1ab4afb31 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -218,14 +218,14 @@ QString JsonWizard::stringValue(const QString &n) const
|
||||
if (!v.isValid())
|
||||
return QString();
|
||||
|
||||
if (v.type() == QVariant::String) {
|
||||
if (v.typeId() == QVariant::String) {
|
||||
QString tmp = m_expander.expand(v.toString());
|
||||
if (tmp.isEmpty())
|
||||
tmp = QString::fromLatin1(""); // Make sure isNull() is *not* true.
|
||||
return tmp;
|
||||
}
|
||||
|
||||
if (v.type() == QVariant::StringList)
|
||||
if (v.typeId() == QVariant::StringList)
|
||||
return stringListToArrayString(v.toStringList(), &m_expander);
|
||||
|
||||
return v.toString();
|
||||
@@ -276,7 +276,7 @@ QVariant JsonWizard::value(const QString &n) const
|
||||
|
||||
bool JsonWizard::boolFromVariant(const QVariant &v, MacroExpander *expander)
|
||||
{
|
||||
if (v.type() == QVariant::String) {
|
||||
if (v.typeId() == QVariant::String) {
|
||||
const QString tmp = expander->expand(v.toString());
|
||||
return !(tmp.isEmpty() || tmp == QLatin1String("false"));
|
||||
}
|
||||
@@ -410,7 +410,7 @@ void JsonWizard::handleError(const QString &message)
|
||||
|
||||
QString JsonWizard::stringify(const QVariant &v) const
|
||||
{
|
||||
if (v.type() == QVariant::StringList)
|
||||
if (v.typeId() == QVariant::StringList)
|
||||
return stringListToArrayString(v.toStringList(), &m_expander);
|
||||
return Wizard::stringify(v);
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ static JsonWizardFactory::Generator parseGenerator(const QVariant &value, QStrin
|
||||
{
|
||||
JsonWizardFactory::Generator gen;
|
||||
|
||||
if (value.type() != QVariant::Map) {
|
||||
if (value.typeId() != QVariant::Map) {
|
||||
*errorMessage = Tr::tr("Generator is not a object.");
|
||||
return gen;
|
||||
}
|
||||
@@ -236,8 +236,8 @@ QVariant JsonWizardFactory::getDataValue(const QLatin1String &key, const QVarian
|
||||
{
|
||||
QVariant retVal = {};
|
||||
|
||||
if ((valueSet.contains(key) && valueSet.value(key).type() == QVariant::Map) ||
|
||||
(defaultValueSet.contains(key) && defaultValueSet.value(key).type() == QVariant::Map)) {
|
||||
if ((valueSet.contains(key) && valueSet.value(key).typeId() == QVariant::Map) ||
|
||||
(defaultValueSet.contains(key) && defaultValueSet.value(key).typeId() == QVariant::Map)) {
|
||||
retVal = mergeDataValueMaps(valueSet.value(key), defaultValueSet.value(key));
|
||||
} else {
|
||||
QVariant defaultValue = defaultValueSet.value(key, notExistValue);
|
||||
@@ -263,7 +263,7 @@ std::pair<int, QStringList> JsonWizardFactory::screenSizeInfoFromPage(const QStr
|
||||
return {};
|
||||
|
||||
const QVariant data = it->data;
|
||||
if (data.type() != QVariant::List)
|
||||
if (data.typeId() != QVariant::List)
|
||||
return {};
|
||||
|
||||
const QVariant screenFactorField = Utils::findOrDefault(data.toList(),
|
||||
@@ -272,11 +272,11 @@ std::pair<int, QStringList> JsonWizardFactory::screenSizeInfoFromPage(const QStr
|
||||
return "ScreenFactor" == m["name"];
|
||||
});
|
||||
|
||||
if (screenFactorField.type() != QVariant::Map)
|
||||
if (screenFactorField.typeId() != QVariant::Map)
|
||||
return {};
|
||||
|
||||
const QVariant screenFactorData = screenFactorField.toMap()["data"];
|
||||
if (screenFactorData.type() != QVariant::Map)
|
||||
if (screenFactorData.typeId() != QVariant::Map)
|
||||
return {};
|
||||
|
||||
const QVariantMap screenFactorDataMap = screenFactorData.toMap();
|
||||
@@ -304,7 +304,7 @@ JsonWizardFactory::Page JsonWizardFactory::parsePage(const QVariant &value, QStr
|
||||
{
|
||||
JsonWizardFactory::Page p;
|
||||
|
||||
if (value.type() != QVariant::Map) {
|
||||
if (value.typeId() != QVariant::Map) {
|
||||
*errorMessage = Tr::tr("Page is not an object.");
|
||||
return p;
|
||||
}
|
||||
@@ -351,9 +351,9 @@ JsonWizardFactory::Page JsonWizardFactory::parsePage(const QVariant &value, QStr
|
||||
|
||||
if (specifiedSubData.isNull())
|
||||
subData = defaultSubData;
|
||||
else if (specifiedSubData.type() == QVariant::Map)
|
||||
else if (specifiedSubData.typeId() == QVariant::Map)
|
||||
subData = mergeDataValueMaps(specifiedSubData.toMap(), defaultSubData.toMap());
|
||||
else if (specifiedSubData.type() == QVariant::List)
|
||||
else if (specifiedSubData.typeId() == QVariant::List)
|
||||
subData = specifiedSubData;
|
||||
|
||||
if (!factory->validateData(typeId, subData, errorMessage))
|
||||
@@ -648,9 +648,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.type() == QVariant::Map)
|
||||
else if (data.typeId() == QVariant::Map)
|
||||
result.append(data);
|
||||
else if (data.type() == QVariant::List)
|
||||
else if (data.typeId() == QVariant::List)
|
||||
result = data.toList();
|
||||
else
|
||||
*errorMessage = Tr::tr("Expected an object or a list.");
|
||||
@@ -661,7 +661,7 @@ QString JsonWizardFactory::localizedString(const QVariant &value)
|
||||
{
|
||||
if (value.isNull())
|
||||
return QString();
|
||||
if (value.type() == QVariant::Map) {
|
||||
if (value.typeId() == QVariant::Map) {
|
||||
QVariantMap tmp = value.toMap();
|
||||
const QString locale = languageSetting().toLower();
|
||||
QStringList locales;
|
||||
|
||||
@@ -96,7 +96,7 @@ Utils::WizardPage *FilePageFactory::create(JsonWizard *wizard, Utils::Id typeId,
|
||||
bool FilePageFactory::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() != QVariant::Map || !data.toMap().isEmpty())) {
|
||||
*errorMessage = Tr::tr("\"data\" for a \"File\" page needs to be unset or an empty object.");
|
||||
return false;
|
||||
}
|
||||
@@ -147,7 +147,7 @@ bool KitsPageFactory::validateData(Utils::Id typeId, const QVariant &data, QStri
|
||||
{
|
||||
QTC_ASSERT(canCreate(typeId), return false);
|
||||
|
||||
if (data.isNull() || data.type() != QVariant::Map) {
|
||||
if (data.isNull() || data.typeId() != QVariant::Map) {
|
||||
*errorMessage = Tr::tr("\"data\" must be a JSON object for \"Kits\" pages.");
|
||||
return false;
|
||||
}
|
||||
@@ -206,7 +206,7 @@ bool ProjectPageFactory::validateData(Utils::Id typeId, const QVariant &data, QS
|
||||
Q_UNUSED(errorMessage)
|
||||
|
||||
QTC_ASSERT(canCreate(typeId), return false);
|
||||
if (!data.isNull() && data.type() != QVariant::Map) {
|
||||
if (!data.isNull() && data.typeId() != QVariant::Map) {
|
||||
*errorMessage = Tr::tr("\"data\" must be empty or a JSON object for \"Project\" pages.");
|
||||
return false;
|
||||
}
|
||||
@@ -252,7 +252,7 @@ Utils::WizardPage *SummaryPageFactory::create(JsonWizard *wizard, Utils::Id type
|
||||
bool SummaryPageFactory::validateData(Utils::Id typeId, const QVariant &data, QString *errorMessage)
|
||||
{
|
||||
QTC_ASSERT(canCreate(typeId), return false);
|
||||
if (!data.isNull() && (data.type() != QVariant::Map)) {
|
||||
if (!data.isNull() && (data.typeId() != QVariant::Map)) {
|
||||
*errorMessage = Tr::tr("\"data\" for a \"Summary\" page can be unset or needs to be an object.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -387,7 +387,7 @@ void ToolChainKitAspect::upgrade(Kit *k)
|
||||
const QVariant value = k->value(oldIdV2);
|
||||
if (value.isNull() && !oldValue.isNull()) {
|
||||
QVariantMap newValue;
|
||||
if (oldValue.type() == QVariant::Map) {
|
||||
if (oldValue.typeId() == QVariant::Map) {
|
||||
// Used between 4.1 and 4.2:
|
||||
newValue = oldValue.toMap();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user