From 85c49fa23ec7ff22797f1c65f307dc8a1dccf95a Mon Sep 17 00:00:00 2001 From: Be Date: Sat, 16 Oct 2021 11:44:13 -0500 Subject: [PATCH] replace deprecated QVariant::canConvert with templated version --- src/library/dao/settingsdao.cpp | 2 +- src/library/proxytrackmodel.cpp | 2 +- src/library/searchquery.cpp | 8 ++++---- src/widget/wtrackproperty.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/library/dao/settingsdao.cpp b/src/library/dao/settingsdao.cpp index b7797c7bbf8..138a40942cd 100644 --- a/src/library/dao/settingsdao.cpp +++ b/src/library/dao/settingsdao.cpp @@ -51,7 +51,7 @@ QString SettingsDAO::getValue(const QString& name, QString defaultValue) const { } bool SettingsDAO::setValue(const QString& name, const QVariant& value) const { - VERIFY_OR_DEBUG_ASSERT(value.canConvert(QMetaType::QString)) { + VERIFY_OR_DEBUG_ASSERT(value.canConvert()) { return false; } diff --git a/src/library/proxytrackmodel.cpp b/src/library/proxytrackmodel.cpp index 8579b4eb9e9..d8a2755c1c4 100644 --- a/src/library/proxytrackmodel.cpp +++ b/src/library/proxytrackmodel.cpp @@ -148,7 +148,7 @@ bool ProxyTrackModel::filterAcceptsRow(int sourceRow, int i = iter.next(); QModelIndex index = itemModel->index(sourceRow, i, sourceParent); QVariant data = itemModel->data(index); - if (data.canConvert(QMetaType::QString)) { + if (data.canConvert()) { QString strData = data.toString(); if (strData.contains(filter)) { rowMatches = true; diff --git a/src/library/searchquery.cpp b/src/library/searchquery.cpp index 027c011f9c3..f914f2ca18e 100644 --- a/src/library/searchquery.cpp +++ b/src/library/searchquery.cpp @@ -172,7 +172,7 @@ TextFilterNode::TextFilterNode(const QSqlDatabase& database, bool TextFilterNode::match(const TrackPointer& pTrack) const { for (const auto& sqlColumn : m_sqlColumns) { QVariant value = getTrackValueForColumn(pTrack, sqlColumn); - if (!value.isValid() || !value.canConvert(QMetaType::QString)) { + if (!value.isValid() || !value.canConvert()) { continue; } @@ -208,7 +208,7 @@ bool NullOrEmptyTextFilterNode::match(const TrackPointer& pTrack) const { if (!m_sqlColumns.isEmpty()) { // only use the major column QVariant value = getTrackValueForColumn(pTrack, m_sqlColumns.first()); - if (!value.isValid() || !value.canConvert(QMetaType::QString)) { + if (!value.isValid() || !value.canConvert()) { return true; } return value.toString().isEmpty(); @@ -334,7 +334,7 @@ double NumericFilterNode::parse(const QString& arg, bool* ok) { bool NumericFilterNode::match(const TrackPointer& pTrack) const { for (const auto& sqlColumn : m_sqlColumns) { QVariant value = getTrackValueForColumn(pTrack, sqlColumn); - if (!value.isValid() || !value.canConvert(QMetaType::Double)) { + if (!value.isValid() || !value.canConvert()) { if (m_bNullQuery) { return true; } @@ -401,7 +401,7 @@ bool NullNumericFilterNode::match(const TrackPointer& pTrack) const { if (!m_sqlColumns.isEmpty()) { // only use the major column QVariant value = getTrackValueForColumn(pTrack, m_sqlColumns.first()); - if (!value.isValid() || !value.canConvert(QMetaType::Double)) { + if (!value.isValid() || !value.canConvert()) { return true; } } diff --git a/src/widget/wtrackproperty.cpp b/src/widget/wtrackproperty.cpp index d3f497de26a..dfc9f3db5f7 100644 --- a/src/widget/wtrackproperty.cpp +++ b/src/widget/wtrackproperty.cpp @@ -81,7 +81,7 @@ void WTrackProperty::slotTrackChanged(TrackId trackId) { void WTrackProperty::updateLabel() { if (m_pCurrentTrack) { QVariant property = m_pCurrentTrack->property(m_property.toUtf8().constData()); - if (property.isValid() && property.canConvert(QMetaType::QString)) { + if (property.isValid() && property.canConvert()) { setText(property.toString()); return; }