summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-10-31 10:35:08 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-10-31 10:35:08 (GMT)
commit33707aa8688541a3c2b7e665ce3806badb4d6f21 (patch)
tree7956f69de1ece1aa760b450eb47b6bb294ff4093
parentd45e53ce6d5013c3a0e1032dacf0c3372cd46952 (diff)
downloadswift-contrib-33707aa8688541a3c2b7e665ce3806badb4d6f21.zip
swift-contrib-33707aa8688541a3c2b7e665ce3806badb4d6f21.tar.bz2
Tweak the group triangles a bit.
-rw-r--r--Swift/QtUI/Roster/GroupItemDelegate.cpp10
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);