From 33707aa8688541a3c2b7e665ce3806badb4d6f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Sun, 31 Oct 2010 11:35:08 +0100 Subject: Tweak the group triangles a bit. 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); -- cgit v0.10.2-6-g49f6