From 17ac447f46530f0569331d92d6646af2d12bada3 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 27 Nov 2024 17:00:26 +0100 Subject: [PATCH] QPainter: simplify the check whether the new brush style is already set The explicit operator==(QBrush, Qt::BrushStyle) does that already, and more correctly, as it follows the semantics of brush == QBrush(pattern). Change-Id: I35ce25fe2e895e441ed7974d35bef762c7c533cc Reviewed-by: Christian Ehrlicher --- src/gui/painting/qpainter.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 82a86c20651..45ea98e5373 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -3763,9 +3763,7 @@ void QPainter::setBrush(Qt::BrushStyle style) qWarning("QPainter::setBrush: Painter not active"); return; } - if (d->state->brush.style() == style && - (style == Qt::NoBrush - || (style == Qt::SolidPattern && d->state->brush.color() == QColor(0, 0, 0)))) + if (d->state->brush == style) return; d->state->brush = QBrush(Qt::black, style); if (d->extended)