From 97bdf1a66d321bcd059a0ee218bec0cc92d1bc7b Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Thu, 19 Nov 2009 21:55:51 +0000 Subject: 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. 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()); -- cgit v0.10.2-6-g49f6