From a0260c6a36b414822908d8a302712d8554e63a61 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Tue, 14 Nov 2023 21:13:11 +0100 Subject: [PATCH] QColorDialog: use std::array instead QPolygon Use std::array instead a dynamic QPolygon since there is no dynamic allocation needed here. Change-Id: Iaa6fce9e0e769f2a5dd47de083208457b430f3c3 Reviewed-by: Axel Spoerl --- src/widgets/dialogs/qcolordialog.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index c4917b65a2..82a1fff24d 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -836,11 +836,10 @@ void QColorLuminancePicker::paintEvent(QPaintEvent *) qDrawShadePanel(&p, r, g, true); p.setPen(g.windowText().color()); p.setBrush(g.windowText()); - QPolygon a; - int y = val2y(val); - a.setPoints(3, w, y, w+5, y+5, w+5, y-5); p.eraseRect(w, 0, 5, height()); - p.drawPolygon(a); + const int y = val2y(val); + const std::array points = {QPoint(w, y), QPoint(w + 5, y + 5), QPoint(w + 5, y - 5)}; + p.drawPolygon(points.data(), static_cast(points.size())); } void QColorLuminancePicker::setCol(int h, int s , int v)