From 056d12d60f93a052e19f6e2cff9b826e500eef16 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 11 Feb 2012 18:02:38 +0100 Subject: Group header layout fixes - Don't use a margin for the first group header - Provide margins between the groups - Use a more subtle coloring - Prevent animation glitches when resizing a window --- src/kitemviews/kitemlistgroupheader.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/kitemviews/kitemlistgroupheader.h') diff --git a/src/kitemviews/kitemlistgroupheader.h b/src/kitemviews/kitemlistgroupheader.h index 5ddf20896..c996a4870 100644 --- a/src/kitemviews/kitemlistgroupheader.h +++ b/src/kitemviews/kitemlistgroupheader.h @@ -62,6 +62,9 @@ public: void setScrollOrientation(Qt::Orientation orientation); Qt::Orientation scrollOrientation() const; + void setItemIndex(int index); + int itemIndex() const; + virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0); protected: @@ -95,19 +98,29 @@ protected: */ virtual void scrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous); + /** + * Is called after the item index has been changed and allows the derived class to react on + * this change. + */ + virtual void itemIndexChanged(int current, int previous); + /** @reimp */ virtual void resizeEvent(QGraphicsSceneResizeEvent* event); private: void updateCache(); + static QColor mixedColor(const QColor& c1, const QColor& c2, int c1Percent = 50); + private: bool m_dirtyCache; QByteArray m_role; QVariant m_data; KItemListStyleOption m_styleOption; Qt::Orientation m_scrollOrientation; + int m_itemIndex; + QColor m_lineColor; QColor m_roleColor; QRectF m_roleBounds; }; -- cgit v1.3.1