summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-01-25 21:15:43 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-02-02 12:49:25 +0000
commitdaee9af969a04a2919a948ba1f5d314626925a9a (patch)
tree19f40c501ea42e4fa4deea7d4e102b863d6c6bab /src/gui/image
parentdf39627fa33392a71ab79aadaa57e5c5e650e79e (diff)
QtGui: mark obsolete QPixmapCache::find() functions as deprecated
QPixmapCache::find(QString) and QPixmapCache::find(QString, QPixmap&) are deprecated since Qt4 times. Explicit mark them as deprecated so they can be removed with Qt6. Change-Id: Iaf185f69afe02203559a1c812fbb4a95c9049a1d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qicon.cpp6
-rw-r--r--src/gui/image/qpixmapcache.cpp12
-rw-r--r--src/gui/image/qpixmapcache.h4
3 files changed, 15 insertions, 7 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 285cdf790a..c3c4b24678 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -315,9 +315,9 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
% HexString<uint>(actualSize.height());
if (mode == QIcon::Active) {
- if (QPixmapCache::find(key % HexString<uint>(mode), pm))
+ if (QPixmapCache::find(key % HexString<uint>(mode), &pm))
return pm; // horray
- if (QPixmapCache::find(key % HexString<uint>(QIcon::Normal), pm)) {
+ if (QPixmapCache::find(key % HexString<uint>(QIcon::Normal), &pm)) {
QPixmap active = pm;
if (QGuiApplication *guiApp = qobject_cast<QGuiApplication *>(qApp))
active = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(guiApp))->applyQIconStyleHelper(QIcon::Active, pm);
@@ -326,7 +326,7 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
}
}
- if (!QPixmapCache::find(key % HexString<uint>(mode), pm)) {
+ if (!QPixmapCache::find(key % HexString<uint>(mode), &pm)) {
if (pm.size() != actualSize)
pm = pm.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
if (pe->mode != mode && mode != QIcon::Normal) {
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 3d1652f68b..66907bebd7 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -469,10 +469,13 @@ QPixmapCacheEntry::~QPixmapCacheEntry()
pm_cache()->releaseKey(key);
}
+#if QT_DEPRECATED_SINCE(5, 13)
/*!
\obsolete
\overload
+ Use bool find(const QString &, QPixmap *) instead.
+
Returns the pixmap associated with the \a key in the cache, or
null if there is no such pixmap.
@@ -494,13 +497,14 @@ QPixmap *QPixmapCache::find(const QString &key)
/*!
\obsolete
- Use bool find(const QString&, QPixmap*) instead.
+ Use bool find(const QString &, QPixmap *) instead.
*/
-bool QPixmapCache::find(const QString &key, QPixmap& pixmap)
+bool QPixmapCache::find(const QString &key, QPixmap &pixmap)
{
return find(key, &pixmap);
}
+#endif
/*!
Looks for a cached pixmap associated with the given \a key in the cache.
@@ -513,7 +517,7 @@ bool QPixmapCache::find(const QString &key, QPixmap& pixmap)
\snippet code/src_gui_image_qpixmapcache.cpp 1
*/
-bool QPixmapCache::find(const QString &key, QPixmap* pixmap)
+bool QPixmapCache::find(const QString &key, QPixmap *pixmap)
{
QPixmap *ptr = pm_cache()->object(key);
if (ptr && pixmap)
@@ -530,7 +534,7 @@ bool QPixmapCache::find(const QString &key, QPixmap* pixmap)
\since 4.6
*/
-bool QPixmapCache::find(const Key &key, QPixmap* pixmap)
+bool QPixmapCache::find(const Key &key, QPixmap *pixmap)
{
//The key is not valid anymore, a flush happened before probably
if (!key.d || !key.d->isValid)
diff --git a/src/gui/image/qpixmapcache.h b/src/gui/image/qpixmapcache.h
index ea10ab1b76..12d05b00f3 100644
--- a/src/gui/image/qpixmapcache.h
+++ b/src/gui/image/qpixmapcache.h
@@ -76,8 +76,12 @@ public:
static int cacheLimit();
static void setCacheLimit(int);
+#if QT_DEPRECATED_SINCE(5, 13)
+ QT_DEPRECATED_X("Use bool find(const QString &, QPixmap *) instead")
static QPixmap *find(const QString &key);
+ QT_DEPRECATED_X("Use bool find(const QString &, QPixmap *) instead")
static bool find(const QString &key, QPixmap &pixmap);
+#endif
static bool find(const QString &key, QPixmap *pixmap);
static bool find(const Key &key, QPixmap *pixmap);
static bool insert(const QString &key, const QPixmap &pixmap);