Skip to content

Commit

Permalink
Fixed compilation failure in Qt6
Browse files Browse the repository at this point in the history
Added Compatibility for Qt6 of QVariant's deprecated members
  • Loading branch information
ShaopengLin committed May 5, 2024
1 parent 904dbb4 commit 2897df3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/contentmanagermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ QVariant ContentManagerModel::data(const QModelIndex& index, int role) const

r = getThumbnail(r);

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if ( r.type() == QVariant::ByteArray )
return r;
#else
if ( r.typeId() == QMetaType::QByteArray )
return r;
#endif

const QString faviconUrl = r.toString();
if ( !faviconUrl.isEmpty() )
Expand Down Expand Up @@ -136,8 +141,13 @@ void ContentManagerModel::setBooksData(const BookInfoList& data, const Downloads
// QString) from where the actual data can be obtained.
QVariant ContentManagerModel::getThumbnail(const QVariant& faviconEntry) const
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if ( faviconEntry.type() == QVariant::ByteArray )
return faviconEntry;
#else
if ( faviconEntry.typeId() == QMetaType::QByteArray )
return faviconEntry;
#endif

const auto faviconUrl = faviconEntry.toString();
return m_iconMap.contains(faviconUrl)
Expand Down

0 comments on commit 2897df3

Please sign in to comment.