Skip to content

Commit

Permalink
Merge pull request #4434 from Be-ing/canConvert
Browse files Browse the repository at this point in the history
replace deprecated QVariant::canConvert with templated version
  • Loading branch information
Be-ing authored Oct 16, 2021
2 parents d916929 + 85c49fa commit 28be756
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/library/dao/settingsdao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<QString>()) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/library/proxytrackmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>()) {
QString strData = data.toString();
if (strData.contains(filter)) {
rowMatches = true;
Expand Down
8 changes: 4 additions & 4 deletions src/library/searchquery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<QString>()) {
continue;
}

Expand Down Expand Up @@ -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<QString>()) {
return true;
}
return value.toString().isEmpty();
Expand Down Expand Up @@ -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<double>()) {
if (m_bNullQuery) {
return true;
}
Expand Down Expand Up @@ -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<double>()) {
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/widget/wtrackproperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<QString>()) {
setText(property.toString());
return;
}
Expand Down

0 comments on commit 28be756

Please sign in to comment.