From e9a96ff80a161fd806be7fc61357070ba996e8d5 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Wed, 25 Jul 2012 12:15:14 +0200 Subject: [PATCH] Mark m_pixmapCacheKey as mutable so we don't have to const_cast. --- src/core/Entry.cpp | 2 +- src/core/Entry.h | 2 +- src/core/Group.cpp | 2 +- src/core/Group.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/Entry.cpp b/src/core/Entry.cpp index 08186c0fc..f0f65a932 100644 --- a/src/core/Entry.cpp +++ b/src/core/Entry.cpp @@ -109,7 +109,7 @@ QPixmap Entry::iconPixmap() const if (!QPixmapCache::find(m_pixmapCacheKey, &pixmap)) { // TODO: check if database() is 0 pixmap = QPixmap::fromImage(database()->metadata()->customIcon(m_data.customIcon)); - const_cast(this)->m_pixmapCacheKey = QPixmapCache::insert(pixmap); + m_pixmapCacheKey = QPixmapCache::insert(pixmap); } return pixmap; diff --git a/src/core/Entry.h b/src/core/Entry.h index c629e3629..345102943 100644 --- a/src/core/Entry.h +++ b/src/core/Entry.h @@ -154,7 +154,7 @@ private: Entry* m_tmpHistoryItem; bool m_modifiedSinceBegin; QPointer m_group; - QPixmapCache::Key m_pixmapCacheKey; + mutable QPixmapCache::Key m_pixmapCacheKey; bool m_updateTimeinfo; }; diff --git a/src/core/Group.cpp b/src/core/Group.cpp index 0f154c027..cde724258 100644 --- a/src/core/Group.cpp +++ b/src/core/Group.cpp @@ -132,7 +132,7 @@ QPixmap Group::iconPixmap() const if (!QPixmapCache::find(m_pixmapCacheKey, &pixmap)) { // TODO: check if m_db is 0 pixmap = QPixmap::fromImage(m_db->metadata()->customIcon(m_customIcon)); - const_cast(this)->m_pixmapCacheKey = QPixmapCache::insert(pixmap); + m_pixmapCacheKey = QPixmapCache::insert(pixmap); } return pixmap; diff --git a/src/core/Group.h b/src/core/Group.h index 1ca543d91..5ed2b2939 100644 --- a/src/core/Group.h +++ b/src/core/Group.h @@ -141,7 +141,7 @@ private: QList m_entries; QPointer m_parent; - QPixmapCache::Key m_pixmapCacheKey; + mutable QPixmapCache::Key m_pixmapCacheKey; bool m_updateTimeinfo;