Port example away from deprecated QVariant API

Change-Id: I284610f216409b593d307b8076c8f638722929e6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Volker Hilsheimer 2021-04-16 11:30:51 +02:00
parent e27390f8e1
commit 6ed83f82fe
2 changed files with 2 additions and 2 deletions

View File

@ -214,7 +214,7 @@ void SettingsTree::updateChildItems(QTreeWidgetItem *parent)
if (value.userType() == QMetaType::UnknownType) {
child->setText(1, "Invalid");
} else {
if (value.type() == QVariant::String) {
if (value.typeId() == QMetaType::QString) {
const QString stringValue = value.toString();
if (m_typeChecker->boolExp.match(stringValue).hasMatch()) {
value.setValue(stringValue.compare("true", Qt::CaseInsensitive) == 0);

View File

@ -333,7 +333,7 @@ class Q_CORE_EXPORT QVariant
explicit QVariant(Type type)
: QVariant(QMetaType(int(type)))
{}
QT_DEPRECATED_VERSION_X_6_0("Use metaType().")
QT_DEPRECATED_VERSION_X_6_0("Use typeId() or metaType().")
Type type() const
{
int type = d.typeId();