summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSérgio Martins <sergio.martins@kdab.com>2014-12-15 21:02:39 +0000
committerSérgio Martins <sergio.martins@kdab.com>2014-12-16 13:44:40 +0100
commit2746fe4243c03c4411f1f279df85db5cdd4c01b3 (patch)
treef2dd04b06ce52ec574b237098049164edf65923a /src
parent87ede1fc7a2b8f184733c8f09ccd8732b6b60353 (diff)
QColorDialog: Fix matching against predefined colors.
The grids are filled top to bottom, left to right, so use division to get the column. Task-number: QTBUG-43371 Change-Id: I02ad518512858ed71e0e3a0cae8c4e02d537a9b9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index 33b374c1bc..ee3ece2d77 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -1489,8 +1489,8 @@ bool QColorDialogPrivate::selectColor(const QColor &col)
const QRgb *match = std::find(standardColors, standardColorsEnd, color);
if (match != standardColorsEnd) {
const int index = int(match - standardColors);
- const int row = index / standardColorRows;
- const int column = index % standardColorRows;
+ const int column = index / standardColorRows;
+ const int row = index % standardColorRows;
_q_newStandard(row, column);
standard->setCurrent(row, column);
standard->setSelected(row, column);
@@ -1505,8 +1505,8 @@ bool QColorDialogPrivate::selectColor(const QColor &col)
const QRgb *match = std::find(customColors, customColorsEnd, color);
if (match != customColorsEnd) {
const int index = int(match - customColors);
- const int row = index / customColorRows;
- const int column = index % customColorRows;
+ const int column = index / customColorRows;
+ const int row = index % customColorRows;
_q_newCustom(row, column);
custom->setCurrent(row, column);
custom->setSelected(row, column);