Replace use of QVariant::type() with Qt 6

This commit is contained in:
Jonas Kvinge
2020-10-24 03:32:40 +02:00
parent 1d555ca17e
commit f7b36ac4c7
10 changed files with 114 additions and 9 deletions

View File

@@ -177,7 +177,11 @@ QString PlaylistDelegateBase::displayText(const QVariant &value, const QLocale&)
QString text;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
switch(value.metaType().id()) {
#else
switch (static_cast<QMetaType::Type>(value.type())) {
#endif
case QMetaType::Int: {
int v = value.toInt();
if (v > 0) text = QString::number(v);
@@ -432,7 +436,11 @@ QString NativeSeparatorsDelegate::displayText(const QVariant &value, const QLoca
const QString string_value = value.toString();
QUrl url;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (value.metaType().id() == QMetaType::QUrl) {
#else
if (value.type() == QVariant::Url) {
#endif
url = value.toUrl();
}
else if (string_value.contains("://")) {