From 5369ee6819a26d9d3f106521c525c03f81a943ce Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Mon, 6 Feb 2012 23:26:20 +0100 Subject: Group header improvements - Use a simpler background and colors as suggested by Martin Zilz. This is just an early draft, I need to post some comparison screenshots to Martin for review. - Fixes of some layout issues that have been revealed because of adjusting the group header heights. - More clever animation/no-animation detection when doing listview-property changes in parallel. --- src/kitemviews/kitemlistgroupheader.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/kitemviews/kitemlistgroupheader.h') diff --git a/src/kitemviews/kitemlistgroupheader.h b/src/kitemviews/kitemlistgroupheader.h index 8f556afc5..5ddf20896 100644 --- a/src/kitemviews/kitemlistgroupheader.h +++ b/src/kitemviews/kitemlistgroupheader.h @@ -30,6 +30,13 @@ class KItemListView; +/** + * @brief Base class for group headers. + * + * Draws a default header background. Derived classes must reimplement + * the method paint() and draw the role within the given roleBounds() with + * the color roleColor(). + */ class LIBDOLPHINPRIVATE_EXPORT KItemListGroupHeader : public QGraphicsWidget { Q_OBJECT @@ -58,6 +65,12 @@ public: virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0); protected: + /** @return Bounding rectangle where the role should be drawn into. */ + QRectF roleBounds() const; + + /** @return Primary color that should be used for drawing the role. */ + QColor roleColor() const; + /** * Is called after the role has been changed and allows the derived class * to react on this change. @@ -87,7 +100,6 @@ protected: private: void updateCache(); - void deleteCache(); private: bool m_dirtyCache; @@ -96,9 +108,8 @@ private: KItemListStyleOption m_styleOption; Qt::Orientation m_scrollOrientation; - QPixmap* m_leftBorderCache; - QPixmap* m_rightBorderCache; - QColor m_outlineColor; + QColor m_roleColor; + QRectF m_roleBounds; }; #endif -- cgit v1.3.1