From 961e6270e4401a6c7512df3a2e3efd09a25df962 Mon Sep 17 00:00:00 2001 From: Méven Car Date: Tue, 14 Jan 2025 18:52:36 +0100 Subject: Refactor Overlay Handling Now all overlays icons in kitemviews are added in KStandardItemListWidget::updatePixmapCache. data[iconOverlays] now contains icon names. DolphinFileItemListWidget::refreshCache is the sole responsible of setting the overlays either coming from KFileItemModelRolesUpdater or KVersionControlPlugin. This garantees consistency in rendering. BUG: 497372 --- src/kitemviews/kstandarditemlistwidget.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/kitemviews/kstandarditemlistwidget.h') diff --git a/src/kitemviews/kstandarditemlistwidget.h b/src/kitemviews/kstandarditemlistwidget.h index d4a4f1231..3e542b4c5 100644 --- a/src/kitemviews/kstandarditemlistwidget.h +++ b/src/kitemviews/kstandarditemlistwidget.h @@ -158,8 +158,8 @@ protected: void setTextColor(const QColor &color); QColor textColor(const QWidget &widget) const; - void setOverlay(const QPixmap &overlay); - QPixmap overlay() const; + void setOverlays(QHash &overlay); + QHash overlays() const; /** * @see KStandardItemListWidgetInformant::roleText(). @@ -212,6 +212,12 @@ private: void updateCompactLayoutTextCache(); void updateDetailsLayoutTextCache(); + QPixmap addOverlays(const QPixmap &pixmap, + const QHash &overlays, + const QSize &size, + qreal devicePixelRatioF, + QIcon::Mode mode = QIcon::Normal) const; + void drawPixmap(QPainter *painter, const QPixmap &pixmap); /** Draw the lines and arrows that visualize the expanded state and level of this row. */ void drawSiblingsInformation(QPainter *painter); @@ -231,7 +237,7 @@ private: */ void closeRoleEditor(); - QPixmap pixmapForIcon(const QString &name, const QStringList &overlays, int size, QIcon::Mode mode) const; + QPixmap pixmapForIcon(const QString &name, const QHash &overlays, const QSize &size, QIcon::Mode mode) const; /** * @return Preferred size of the rating-image based on the given @@ -283,7 +289,7 @@ private: QColor m_customTextColor; QColor m_additionalInfoTextColor; - QPixmap m_overlay; + QHash m_overlays; QPixmap m_rating; KItemListRoleEditor *m_roleEditor; -- cgit v1.3.1