Replace use of QVariant::type() with Qt 6
This commit is contained in:
@@ -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("://")) {
|
||||
|
||||
@@ -116,7 +116,7 @@ class PlaylistItem : public std::enable_shared_from_this<PlaylistItem> {
|
||||
enum DatabaseColumn { Column_CollectionId };
|
||||
|
||||
virtual QVariant DatabaseValue(DatabaseColumn) const {
|
||||
return QVariant(QVariant::String);
|
||||
return QVariant(QString());
|
||||
}
|
||||
virtual Song DatabaseSongMetadata() const { return Song(); }
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <QFontMetrics>
|
||||
#include <QKeySequence>
|
||||
#include <QMimeData>
|
||||
#include <QMetaType>
|
||||
#include <QList>
|
||||
#include <QSize>
|
||||
#include <QTimeLine>
|
||||
@@ -1328,7 +1329,11 @@ void PlaylistView::CopyCurrentSongToClipboard() const {
|
||||
}
|
||||
|
||||
const QVariant var_data = model()->data(currentIndex().sibling(currentIndex().row(), i));
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
if (var_data.metaType().id() == QMetaType::QString) {
|
||||
#else
|
||||
if (var_data.type() == QVariant::String) {
|
||||
#endif
|
||||
columns << var_data.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user