QColorDialog: use std::array instead QPolygon

Use std::array<QPoint, 5> instead a dynamic QPolygon since there is no
dynamic allocation needed here.

Change-Id: Iaa6fce9e0e769f2a5dd47de083208457b430f3c3
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
bb10
Christian Ehrlicher 2023-11-14 21:13:11 +01:00
parent b1e16ec1e8
commit a0260c6a36
1 changed files with 3 additions and 4 deletions

View File

@ -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<QPoint, 3> points = {QPoint(w, y), QPoint(w + 5, y + 5), QPoint(w + 5, y - 5)};
p.drawPolygon(points.data(), static_cast<int>(points.size()));
}
void QColorLuminancePicker::setCol(int h, int s , int v)