summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-12-27 09:13:18 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-12-27 09:13:18 (GMT)
commit7840105a9828127720a67e7a636e09169b362bce (patch)
treeda3f4499bdd8f221452755cf4efd4b98c9f9b926 /Swift/QtUI
parentc928a0e07b2c23837a2d66285398ce45b3ed8024 (diff)
downloadswift-7840105a9828127720a67e7a636e09169b362bce.zip
swift-7840105a9828127720a67e7a636e09169b362bce.tar.bz2
Elide group header when necessary.
Resolves: #677
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/Roster/GroupItemDelegate.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Swift/QtUI/Roster/GroupItemDelegate.cpp b/Swift/QtUI/Roster/GroupItemDelegate.cpp
index 6691b26..ffe0a98 100644
--- a/Swift/QtUI/Roster/GroupItemDelegate.cpp
+++ b/Swift/QtUI/Roster/GroupItemDelegate.cpp
@@ -61,11 +61,11 @@ void GroupItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& opt
contactCountWidth = groupMetrics.width(countString) + 2 * common_.horizontalMargin;
int offsetAmount = textRect.width() - contactCountWidth + common_.horizontalMargin;
QRect countRect = textRect.adjusted(offsetAmount, 0, 0/*-1 * offsetAmount*/, 0);
- //qDebug() << "Painting count string " << countString << " at " << countRect << " from offset " << offsetAmount;
paintShadowText(painter, countRect, countString);
}
- QRect nameTextRect = textRect.adjusted(0, 0, contactCountWidth, 0);
- paintShadowText(painter, nameTextRect, name);
+ QRect nameTextRect = expanded ? textRect : textRect.adjusted(0, 0, -contactCountWidth, 0);
+ QString elidedName = fontMetrics.elidedText(name, Qt::ElideRight, nameTextRect.width(), Qt::TextShowMnemonic);
+ paintShadowText(painter, nameTextRect, elidedName);
painter->restore();
}