Fix QMetaType::type() related deprecation warnings

Not in sdktool, which still builds with Qt 5.15

Change-Id: I6e6f4331127b821e471e2840e7959cd65e6419e9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2024-05-23 09:37:34 +02:00
parent af3ab760ad
commit f30d369b99
62 changed files with 295 additions and 295 deletions

View File

@@ -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);