Skip to content

Commit

Permalink
COMP: Fix QPixmapCache::find deprecation warnings in ctkPixmapIconEngine
Browse files Browse the repository at this point in the history
This commit fixes warnings like the following reported when building
against Qt >= 5.13.

  /path/to/S-r/CTK/Libs/Widgets/ctkPixmapIconEngine.cpp:187:27: warning: 'find' is deprecated: Use bool find(const QString &, QPixmap *) instead
        [-Wdeprecated-declarations]
          if (QPixmapCache::find(key + QString::number(static_cast<int>(mode)), pm))
                            ^
  /path/to/Support/Qt/5.15.2/clang_64/lib/QtGui.framework/Headers/qpixmapcache.h:80:5: note: 'find' has been explicitly marked deprecated here
      QT_DEPRECATED_X("Use bool find(const QString &, QPixmap *) instead")
      ^
  /path/to/Support/Qt/5.15.2/clang_64/lib/QtCore.framework/Headers/qglobal.h:294:33: note: expanded from macro 'QT_DEPRECATED_X'
  #  define QT_DEPRECATED_X(text) Q_DECL_DEPRECATED_X(text)
                                  ^
  /path/to/Support/Qt/5.15.2/clang_64/lib/QtCore.framework/Headers/qcompilerdetection.h:675:55: note: expanded from macro 'Q_DECL_DEPRECATED_X'
  #    define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text)))
                                                        ^
  • Loading branch information
jcfr committed Nov 5, 2021
1 parent ab26535 commit 0f79789
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Libs/Widgets/ctkPixmapIconEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ QPixmap ctkPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::


if (mode == QIcon::Active) {
if (QPixmapCache::find(key + QString::number(static_cast<int>(mode)), pm))
if (QPixmapCache::find(key + QString::number(static_cast<int>(mode)), &pm))
return pm; // horray
if (QPixmapCache::find(key + QString::number(static_cast<int>(QIcon::Normal)), pm)) {
if (QPixmapCache::find(key + QString::number(static_cast<int>(QIcon::Normal)), &pm)) {
QStyleOption opt(0);
opt.palette = QApplication::palette();
QPixmap active = QApplication::style()->generatedIconPixmap(QIcon::Active, pm, &opt);
Expand All @@ -195,7 +195,7 @@ QPixmap ctkPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::
}
}

if (!QPixmapCache::find(key + QString::number(static_cast<int>(mode)), pm)) {
if (!QPixmapCache::find(key + QString::number(static_cast<int>(mode)), &pm)) {
if (pm.size() != actualSize)
pm = pm.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
if (pe->mode != mode && mode != QIcon::Normal) {
Expand Down

0 comments on commit 0f79789

Please sign in to comment.