summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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());