diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-12-27 09:13:18 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-12-27 09:13:18 (GMT) |
commit | 7840105a9828127720a67e7a636e09169b362bce (patch) | |
tree | da3f4499bdd8f221452755cf4efd4b98c9f9b926 /Swift/QtUI/Roster | |
parent | c928a0e07b2c23837a2d66285398ce45b3ed8024 (diff) | |
download | swift-7840105a9828127720a67e7a636e09169b362bce.zip swift-7840105a9828127720a67e7a636e09169b362bce.tar.bz2 |
Elide group header when necessary.
Resolves: #677
Diffstat (limited to 'Swift/QtUI/Roster')
-rw-r--r-- | Swift/QtUI/Roster/GroupItemDelegate.cpp | 6 |
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(); } |