summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2009-07-31 20:47:51 (GMT)
committerKevin Smith <git@kismith.co.uk>2009-07-31 20:47:51 (GMT)
commitcd40e329581cb942603140402c9d1970e71ebbd0 (patch)
tree4a28f11b5f906238254d7ee319ae7bed2084db92 /Swift/QtUI/Roster
parent99b65c4dd72105755a7cf95297c9cf69dcbc6446 (diff)
downloadswift-cd40e329581cb942603140402c9d1970e71ebbd0.zip
swift-cd40e329581cb942603140402c9d1970e71ebbd0.tar.bz2
Render status text italicised, and selection colours.
Diffstat (limited to 'Swift/QtUI/Roster')
-rw-r--r--Swift/QtUI/Roster/RosterDelegate.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/Swift/QtUI/Roster/RosterDelegate.cpp b/Swift/QtUI/Roster/RosterDelegate.cpp
index b6b9ded..aee58fa 100644
--- a/Swift/QtUI/Roster/RosterDelegate.cpp
+++ b/Swift/QtUI/Roster/RosterDelegate.cpp
@@ -1,6 +1,8 @@
#include "RosterDelegate.h"
#include <QPainter>
+#include <QColor>
+#include <QBrush>
#include <qdebug.h>
#include "QtTreeWidgetItem.h"
@@ -28,17 +30,25 @@ void RosterDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option
//QStyledItemDelegate::paint(painter, option, index);
//initStyleOption(option, index);
QRect fullRegion(option.rect);
-
+ if ( option.state & QStyle::State_Selected ) {
+ painter->fillRect(fullRegion, option.palette.highlight());
+ painter->setPen(option.palette.highlightedText().color());
+ }
QRect avatarRegion(QPoint(0, fullRegion.top()), QSize(32, 32));
QIcon icon = index.data(AvatarRole).isValid() && !index.data(AvatarRole).value<QIcon>().isNull()
? index.data(AvatarRole).value<QIcon>()
: QIcon(":/icons/avatar.png");
icon.paint(painter, avatarRegion, Qt::AlignVCenter | Qt::AlignHCenter);
+ QFont nameFont = painter->font();
+ QFont statusFont = painter->font();
+ statusFont.setStyle(QFont::StyleItalic);
+ //statusFont.setSize(-1);
+ painter->setFont(nameFont);
QRect textRegion(fullRegion.adjusted(avatarRegion.width(), 0, 0, 0));
QRect nameRegion(textRegion.adjusted(0,0,0,-25));
painter->drawText(nameRegion, Qt::AlignVCenter, index.data(Qt::DisplayRole).toString());
-
+ painter->setFont(statusFont);
QRect statusTextRegion(textRegion.adjusted(0, 25, 0, 0));
painter->drawText(statusTextRegion, Qt::AlignVCenter, index.data(StatusTextRole).toString());