diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-10-31 10:35:08 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-10-31 10:35:08 (GMT) |
commit | 33707aa8688541a3c2b7e665ce3806badb4d6f21 (patch) | |
tree | 7956f69de1ece1aa760b450eb47b6bb294ff4093 /Swift | |
parent | d45e53ce6d5013c3a0e1032dacf0c3372cd46952 (diff) | |
download | swift-contrib-33707aa8688541a3c2b7e665ce3806badb4d6f21.zip swift-contrib-33707aa8688541a3c2b7e665ce3806badb4d6f21.tar.bz2 |
Tweak the group triangles a bit.
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/QtUI/Roster/GroupItemDelegate.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Swift/QtUI/Roster/GroupItemDelegate.cpp b/Swift/QtUI/Roster/GroupItemDelegate.cpp index bca83c7..6691b26 100644 --- a/Swift/QtUI/Roster/GroupItemDelegate.cpp +++ b/Swift/QtUI/Roster/GroupItemDelegate.cpp @@ -42,11 +42,12 @@ void GroupItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& opt painter->fillPath(fillPath, backgroundBrush); painter->drawPath(linePath); + int triangleHorizontalOffset = 1; int triangleWidth = 9; int triangleHeight = 5; - paintExpansionTriangle(painter, region.adjusted(common_.horizontalMargin + 1, 0, 0, 0), triangleWidth, triangleHeight, expanded); + paintExpansionTriangle(painter, region.adjusted(common_.horizontalMargin + triangleHorizontalOffset + 1, 0, 0, 0), triangleWidth, triangleHeight, expanded); - int textLeftOffset = 3 * common_.horizontalMargin + 1 + triangleWidth; + int textLeftOffset = 3 * common_.horizontalMargin + 1 + triangleWidth + triangleHorizontalOffset; QFontMetrics fontMetrics(groupFont_); int textTopOffset = (region.height() - fontMetrics.height()) / 2; painter->setFont(groupFont_); @@ -76,9 +77,12 @@ void GroupItemDelegate::paintExpansionTriangle(QPainter* painter, const QRect& r triangle << triangleTopLeft; triangle << triangleTopLeft + QPointF(width, 0); triangle << triangleTopLeft + QPointF(width / 2, height); + // The expanded triangle should be a little lower, because its pointy shape makes it feel + // as if it's too high. + triangle.translate(QPointF(0,1)); } else { - QPointF triangleTopLeft(region.left(), region.top() + region.height() / 2 - width / 2); + QPointF triangleTopLeft(region.left() + ((width - height) / 2), region.top() + region.height() / 2 - width / 2); triangle << triangleTopLeft; triangle << triangleTopLeft + QPointF(height, width / 2); triangle << triangleTopLeft + QPointF(0, width); |