Prepare for potential QVariant::QVariant(const char *) deprecation

Change-Id: I772f7b454e8f015c9e5bfc8e165e64deb2e3089a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
hjk
2019-01-24 11:26:57 +01:00
parent f5c3007058
commit db32dfe7a4
3 changed files with 9 additions and 6 deletions

View File

@@ -89,7 +89,8 @@ void ColorThemes::updateColorThemeMenu()
m_menu->clear(); m_menu->clear();
const QSettings *s = Core::ICore::settings(); const QSettings *s = Core::ICore::settings();
const QString currentTheme = s->value(Constants::C_SETTINGS_COLORSETTINGS_CURRENTCOLORTHEME, Constants::C_COLOR_SCHEME_DEFAULT).toString(); const QString currentTheme = s->value(Constants::C_SETTINGS_COLORSETTINGS_CURRENTCOLORTHEME,
QString(Constants::C_COLOR_SCHEME_DEFAULT)).toString();
const QVariantMap data = s->value(Constants::C_SETTINGS_COLORSETTINGS_COLORTHEMES).toMap(); const QVariantMap data = s->value(Constants::C_SETTINGS_COLORSETTINGS_COLORTHEMES).toMap();
QStringList keys = data.keys(); QStringList keys = data.keys();
keys.append(Constants::C_COLOR_SCHEME_SCXMLDOCUMENT); keys.append(Constants::C_COLOR_SCHEME_SCXMLDOCUMENT);

View File

@@ -158,7 +158,8 @@ QVariant WarningModel::data(const QModelIndex &index, int role) const
switch (role) { switch (role) {
case WarningModel::FilterRole: case WarningModel::FilterRole:
return it->isActive() ? Constants::C_WARNINGMODEL_FILTER_ACTIVE : Constants::C_WARNINGMODEL_FILTER_NOT; return QString::fromLatin1(it->isActive() ? Constants::C_WARNINGMODEL_FILTER_ACTIVE
: Constants::C_WARNINGMODEL_FILTER_NOT);
case Qt::DecorationRole: { case Qt::DecorationRole: {
if (col == 0) if (col == 0)
return severityIcon(it->severity()); return severityIcon(it->severity());

View File

@@ -97,10 +97,11 @@ QVariant SCAttributeItemModel::data(const QModelIndex &index, int role) const
if (bEditable) { if (bEditable) {
return m_tag->attributeName(index.row()); return m_tag->attributeName(index.row());
} else { } else {
if (m_tag->info()->attributes[index.row()].required) scxmltag_attribute_t attr = m_tag->info()->attributes[index.row()];
return QString::fromLatin1("*%1").arg(QLatin1String(m_tag->info()->attributes[index.row()].name)); if (attr.required)
return QString::fromLatin1("*%1").arg(QLatin1String(attr.name));
else else
return m_tag->info()->attributes[index.row()].name; return QString::fromLatin1(attr.name);
} }
} else { } else {
if (bEditable) { if (bEditable) {
@@ -128,7 +129,7 @@ QVariant SCAttributeItemModel::data(const QModelIndex &index, int role) const
} }
case DataRole: { case DataRole: {
if (m_tag->info()->n_attributes > 0) if (m_tag->info()->n_attributes > 0)
return m_tag->info()->attributes[index.row()].value; return QString::fromLatin1(m_tag->info()->attributes[index.row()].value);
else else
return QVariant(); return QVariant();
} }