summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2009-11-19 21:55:51 (GMT)
committerKevin Smith <git@kismith.co.uk>2009-11-19 21:55:51 (GMT)
commit97bdf1a66d321bcd059a0ee218bec0cc92d1bc7b (patch)
treec9ef5dcd9daf6cdd249dd41f56d9178bc9515f74 /Swift/QtUI/Roster
parent3da134b970a6f25a5e900bd2a55b03c5242378f0 (diff)
downloadswift-97bdf1a66d321bcd059a0ee218bec0cc92d1bc7b.zip
swift-97bdf1a66d321bcd059a0ee218bec0cc92d1bc7b.tar.bz2
More space between the avatar and text in the roster (#221)
This was requested by Steve, I can't say that I'm convinced but maybe it'll grow on me.
Diffstat (limited to 'Swift/QtUI/Roster')
-rw-r--r--Swift/QtUI/Roster/RosterDelegate.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/Swift/QtUI/Roster/RosterDelegate.cpp b/Swift/QtUI/Roster/RosterDelegate.cpp
index 659f360..661c02d 100644
--- a/Swift/QtUI/Roster/RosterDelegate.cpp
+++ b/Swift/QtUI/Roster/RosterDelegate.cpp
@@ -175,10 +175,12 @@ void RosterDelegate::paintContact(QPainter* painter, const QStyleOptionViewItem&
: QIcon(":/icons/offline.png");
presenceIcon.paint(painter, presenceIconRegion, Qt::AlignBottom | Qt::AlignHCenter);
+ QFontMetrics nameMetrics(nameFont_);
painter->setFont(nameFont_);
- QRect textRegion(fullRegion.adjusted(avatarRegion.right() + horizontalMargin_ * 2, 0, 0, 0));
+ int extraFontWidth = nameMetrics.width("H");
+ int leftOffset = avatarRegion.right() + horizontalMargin_ * 2 + extraFontWidth / 2;
+ QRect textRegion(fullRegion.adjusted(leftOffset, 0, -leftOffset, 0));
- QFontMetrics nameMetrics(nameFont_);
int nameHeight = nameMetrics.height() + verticalMargin_;
QRect nameRegion(textRegion.adjusted(0, verticalMargin_, 0, 0));
@@ -187,6 +189,7 @@ void RosterDelegate::paintContact(QPainter* painter, const QStyleOptionViewItem&
painter->setFont(statusFont_);
painter->setPen(QPen(QColor(160,160,160)));
+
QRect statusTextRegion(textRegion.adjusted(0, nameHeight, 0, 0));
painter->drawText(statusTextRegion, Qt::AlignTop, index.data(StatusTextRole).toString());