diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2023-11-14 21:13:11 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2023-11-16 06:15:25 +0100 |
commit | a0260c6a36b414822908d8a302712d8554e63a61 (patch) | |
tree | 64bf99b3ce3b43d2f72348187da3d34ae96af71e /src/widgets/dialogs/qcolordialog.cpp | |
parent | b1e16ec1e8b6bba083a67e5a93ee3adafec8eefe (diff) |
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>
Diffstat (limited to 'src/widgets/dialogs/qcolordialog.cpp')
-rw-r--r-- | src/widgets/dialogs/qcolordialog.cpp | 7 |
1 files 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<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) |