diff --git a/src/core/Entry.cpp b/src/core/Entry.cpp index 0634e20b..784b489c 100644 --- a/src/core/Entry.cpp +++ b/src/core/Entry.cpp @@ -123,6 +123,19 @@ QPixmap Entry::iconPixmap() const } } +QPixmap Entry::iconScaledPixmap() const +{ + if (m_data.customIcon.isNull()) { + // built-in icons are 16x16 so don't need to be scaled + return databaseIcons()->iconPixmap(m_data.iconNumber); + } + else { + Q_ASSERT(database()); + + return database()->metadata()->customIconScaledPixmap(m_data.customIcon); + } +} + int Entry::iconNumber() const { return m_data.iconNumber; diff --git a/src/core/Entry.h b/src/core/Entry.h index 4b3502f7..3044dc81 100644 --- a/src/core/Entry.h +++ b/src/core/Entry.h @@ -60,6 +60,7 @@ public: Uuid uuid() const; QImage icon() const; QPixmap iconPixmap() const; + QPixmap iconScaledPixmap() const; int iconNumber() const; Uuid iconUuid() const; QColor foregroundColor() const; diff --git a/src/core/Group.cpp b/src/core/Group.cpp index ece40df7..371f3e4d 100644 --- a/src/core/Group.cpp +++ b/src/core/Group.cpp @@ -143,6 +143,24 @@ QPixmap Group::iconPixmap() const } } +QPixmap Group::iconScaledPixmap() const +{ + if (m_data.customIcon.isNull()) { + // built-in icons are 16x16 so don't need to be scaled + return databaseIcons()->iconPixmap(m_data.iconNumber); + } + else { + Q_ASSERT(m_db); + + if (m_db) { + return m_db->metadata()->customIconScaledPixmap(m_data.customIcon); + } + else { + return QPixmap(); + } + } +} + int Group::iconNumber() const { return m_data.iconNumber; diff --git a/src/core/Group.h b/src/core/Group.h index 2bc20b7b..3881ed24 100644 --- a/src/core/Group.h +++ b/src/core/Group.h @@ -58,6 +58,7 @@ public: QString notes() const; QImage icon() const; QPixmap iconPixmap() const; + QPixmap iconScaledPixmap() const; int iconNumber() const; Uuid iconUuid() const; TimeInfo timeInfo() const;