┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kcategorydrawer.cpp
diff options
context:
space:
mode:
authorRafael Fernández López <[email protected]>2007-12-25 17:37:41 +0000
committerRafael Fernández López <[email protected]>2007-12-25 17:37:41 +0000
commite4170c1910ad91fd31bc64edfab17ddc814411d5 (patch)
tree03a3c74328dcf47536622c32e81f9802d1909d54 /src/kcategorydrawer.cpp
parent8ded05f86d425ede250aa2ee3ed6b5fbc87e37f9 (diff)
Fixes, fixes, fixes:
* Better item appearance (selected and hover) on systemsettings. * Keyboard navigation improved in dolphin, and now is possible to navigate with keyboard in systemsettings (it was not possible before). * No rubberband or multiple selection on systemsettings. * Single or double click for item activation depends on the system state on systemsettings. * On KCategoryDrawer now titles are drawn with more margin, as happens on DolphinCategoryDrawer. This gives more consistency to its look. CCMAIL: [email protected] svn path=/trunk/KDE/kdebase/apps/; revision=752784
Diffstat (limited to 'src/kcategorydrawer.cpp')
-rw-r--r--src/kcategorydrawer.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/kcategorydrawer.cpp b/src/kcategorydrawer.cpp
index d0c671915..53cf059f1 100644
--- a/src/kcategorydrawer.cpp
+++ b/src/kcategorydrawer.cpp
@@ -23,6 +23,7 @@
#include <QPainter>
#include <QStyleOption>
+#include <kiconloader.h>
#include <kcategorizedsortfilterproxymodel.h>
KCategoryDrawer::KCategoryDrawer()
@@ -61,6 +62,17 @@ void KCategoryDrawer::drawCategory(const QModelIndex &index,
opt.direction = option.direction;
opt.text = category;
+ int iconSize = KIconLoader::global()->currentSize(KIconLoader::Small);
+
+ if (option.direction == Qt::LeftToRight)
+ {
+ opt.rect.setLeft(opt.rect.left() + (iconSize / 4));
+ }
+ else
+ {
+ opt.rect.setRight(opt.rect.width() - (iconSize / 4));
+ }
+
if (option.state & QStyle::State_Selected)
{
QColor selected = option.palette.color(QPalette::Highlight);
@@ -113,7 +125,7 @@ void KCategoryDrawer::drawCategory(const QModelIndex &index,
painter->setPen(color);
- painter->drawText(option.rect, Qt::AlignVCenter | Qt::AlignLeft,
+ painter->drawText(opt.rect, Qt::AlignVCenter | Qt::AlignLeft,
metrics.elidedText(category, Qt::ElideRight, option.rect.width()));
painter->restore();