Skip to content

Commit

Permalink
BaseTrackTableModel: fix Qt6 QVariant deprecation warning
Browse files Browse the repository at this point in the history
../src/library/basetracktablemodel.cpp: In member function ‘QVariant BaseTrackTableModel::roleValue(const QModelIndex&, QVariant&&, int) const’:
../src/library/basetracktablemodel.cpp:649:30: warning: ‘QVariant::Type QVariant::type() const’ is deprecated: Use typeId() or metaType(). [-Wdeprecated-declarations]
  649 |             if (rawValue.type() == QVariant::String) {
      |                 ~~~~~~~~~~~~~^~
In file included from /usr/include/qt6/QtCore/qabstractitemmodel.h:47,
                 from /usr/include/qt6/QtCore/QAbstractTableModel:1,
                 from ../src/library/basetracktablemodel.h:3,
                 from ../src/library/basetracktablemodel.cpp:1:
/usr/include/qt6/QtCore/qvariant.h:337:10: note: declared here
  337 |     Type type() const
      |          ^~~~
  • Loading branch information
Be-ing committed Oct 16, 2021
1 parent 28be756 commit 4918c86
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/library/basetracktablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,11 @@ QVariant BaseTrackTableModel::roleValue(
}
case ColumnCache::COLUMN_LIBRARYTABLE_LAST_PLAYED_AT: {
QDateTime lastPlayedAt;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (rawValue.metaType() == QMetaType(QMetaType::QString)) {
#else
if (rawValue.type() == QVariant::String) {
#endif
// column value
lastPlayedAt = mixxx::sqlite::readGeneratedTimestamp(rawValue);
} else {
Expand Down

0 comments on commit 4918c86

Please sign in to comment.