From cd40e329581cb942603140402c9d1970e71ebbd0 Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Fri, 31 Jul 2009 21:47:51 +0100 Subject: Render status text italicised, and selection colours. 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 +#include +#include #include #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().isNull() ? index.data(AvatarRole).value() : 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()); -- cgit v0.10.2-6-g49f6