Replace deprecated QVariant::Type with QMetaType in UserProperties

QVariant::type() and the QVariant::Type enum are deprecated in Qt6.
Switch on userType() (non-deprecated, returns the QMetaType id and
works on Qt5 too) with QMetaType enum cases. Clears 6 -Wdeprecated-
declarations warnings; the numeric type ids are unchanged.
This commit is contained in:
Dieter Mayer
2026-07-12 21:47:29 +02:00
parent 1265e51ebe
commit 7e08cd1285
+6 -6
View File
@@ -44,17 +44,17 @@ QDomElement UserProperties::toXml(QDomDocument &xml_document) const
for (auto i = m_properties.begin(); i != m_properties.end(); ++i)
{
auto type = i.value().type();
auto type = i.value().userType();
switch(type) {
case QVariant::Type::String:
case QMetaType::QString:
up.appendChild(QETXML::createXmlProperty(i.key(), i.value().toString())); break;
case QVariant::Type::Int:
case QMetaType::Int:
up.appendChild(QETXML::createXmlProperty(i.key(), i.value().toInt())); break;
case QVariant::Type::Double:
case QMetaType::Double:
up.appendChild(QETXML::createXmlProperty(i.key(), i.value().toDouble())); break;
case QVariant::Type::Bool:
case QMetaType::Bool:
up.appendChild(QETXML::createXmlProperty(i.key(), i.value().toBool())); break;
case QVariant::Type::Color:
case QMetaType::QColor:
up.appendChild(QETXML::createXmlProperty(i.key(), QColor(i.value().value<QColor>()))); break;
default:
break;