┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistgroupheader.h
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2012-02-06 23:26:20 +0100
committerPeter Penz <[email protected]>2012-02-06 23:31:49 +0100
commit5369ee6819a26d9d3f106521c525c03f81a943ce (patch)
treeb6a31372f7fa6cd58aac1c7faeca6d5d96d50e32 /src/kitemviews/kitemlistgroupheader.h
parent7af39fb960352e0504153c627db0615d80758ebe (diff)
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.
Diffstat (limited to 'src/kitemviews/kitemlistgroupheader.h')
-rw-r--r--src/kitemviews/kitemlistgroupheader.h19
1 files changed, 15 insertions, 4 deletions
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