┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphincategorydrawer.cpp
diff options
context:
space:
mode:
authorRafael Fernández López <[email protected]>2007-09-17 06:03:40 +0000
committerRafael Fernández López <[email protected]>2007-09-17 06:03:40 +0000
commitb3db0a708a630d9f59857ab7dcbfe8f29e3e8eb9 (patch)
tree625306a1db97804e096591ad92a54350c73f2e6c /src/dolphincategorydrawer.cpp
parent3c77e0f7204dcc7933b2f91ed462d61e92301b29 (diff)
Give feedback to user when clicking on a category and the user is not dragging from it. Beauty, come to me :)
CCMAIL: [email protected] svn path=/trunk/KDE/kdebase/apps/; revision=713337
Diffstat (limited to 'src/dolphincategorydrawer.cpp')
-rw-r--r--src/dolphincategorydrawer.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/dolphincategorydrawer.cpp b/src/dolphincategorydrawer.cpp
index 039b395a4..42f55f473 100644
--- a/src/dolphincategorydrawer.cpp
+++ b/src/dolphincategorydrawer.cpp
@@ -62,7 +62,16 @@ void DolphinCategoryDrawer::drawCategory(const QModelIndex &index, int sortRole,
const QString category = categoryVariant.toString();
- QColor color = option.palette.color(QPalette::Text);
+ QColor color;
+
+ if (option.state & QStyle::State_Selected)
+ {
+ color = option.palette.color(QPalette::HighlightedText);
+ }
+ else
+ {
+ color = option.palette.color(QPalette::Text);
+ }
painter->save();
painter->setRenderHint(QPainter::Antialiasing);
@@ -74,7 +83,20 @@ void DolphinCategoryDrawer::drawCategory(const QModelIndex &index, int sortRole,
opt.direction = option.direction;
opt.text = category;
- if (option.state & QStyle::State_MouseOver)
+ if (option.state & QStyle::State_Selected)
+ {
+ QColor selected = option.palette.color(QPalette::Highlight);
+
+ QLinearGradient gradient(option.rect.topLeft(),
+ option.rect.bottomRight());
+ gradient.setColorAt(option.direction == Qt::LeftToRight ? 0
+ : 1, selected);
+ gradient.setColorAt(option.direction == Qt::LeftToRight ? 1
+ : 0, Qt::transparent);
+
+ painter->fillRect(option.rect, gradient);
+ }
+ else if (option.state & QStyle::State_MouseOver)
{
QColor hover = option.palette.color(QPalette::Highlight).light();
hover.setAlpha(88);