Fusion style: cleanup PE_IndicatorToolBarSeparator drawing

Cleanup drawing of PE_IndicatorToolBarSeparator - there is no need to
call QRect::topLeft/bottomRight() and then only use x or y. No need to
stress the optimizer that much.

Change-Id: I477dcea6c9bebd981777fdc1eb53963074257e01
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9fa471f9c7b4f2218109fa4bd17d66cf5b24101d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Christian Ehrlicher 2024-11-22 21:19:21 +01:00 committed by Qt Cherry-pick Bot
parent 49cb3203a9
commit 6f353bb066

View File

@ -477,30 +477,22 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
{
QRect rect = option->rect;
const int margin = 6;
const QColor col = option->palette.window().color();
painter->setPen(col.darker(110));
if (option->state & State_Horizontal) {
const int offset = rect.width()/2;
painter->setPen(QPen(option->palette.window().color().darker(110)));
painter->drawLine(rect.bottomLeft().x() + offset,
rect.bottomLeft().y() - margin,
rect.topLeft().x() + offset,
rect.topLeft().y() + margin);
painter->setPen(QPen(option->palette.window().color().lighter(110)));
painter->drawLine(rect.bottomLeft().x() + offset + 1,
rect.bottomLeft().y() - margin,
rect.topLeft().x() + offset + 1,
rect.topLeft().y() + margin);
const int offset = rect.width() / 2;
painter->drawLine(rect.left() + offset, rect.bottom() - margin,
rect.left() + offset, rect.top() + margin);
painter->setPen(col.lighter(110));
painter->drawLine(rect.left() + offset + 1, rect.bottom() - margin,
rect.left() + offset + 1, rect.top() + margin);
} else { //Draw vertical separator
const int offset = rect.height()/2;
painter->setPen(QPen(option->palette.window().color().darker(110)));
painter->drawLine(rect.topLeft().x() + margin ,
rect.topLeft().y() + offset,
rect.topRight().x() - margin,
rect.topRight().y() + offset);
painter->setPen(QPen(option->palette.window().color().lighter(110)));
painter->drawLine(rect.topLeft().x() + margin ,
rect.topLeft().y() + offset + 1,
rect.topRight().x() - margin,
rect.topRight().y() + offset + 1);
const int offset = rect.height() / 2;
painter->drawLine(rect.left() + margin, rect.top() + offset,
rect.right() - margin, rect.top() + offset);
painter->setPen(col.lighter(110));
painter->drawLine(rect.left() + margin, rect.top() + offset + 1,
rect.right() - margin, rect.top() + offset + 1);
}
}
break;