summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qcolordialog.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2013-06-27 13:31:34 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-03 12:30:22 +0200
commit17fe17d525ffde65fcbe88c6ade539ab8bca1772 (patch)
treedc380966d6fb3e090fe38ba56d2c308462065c8c /src/widgets/dialogs/qcolordialog.cpp
parentbc03e80f9a6686d67744045f4015623c6ee79c2a (diff)
Set correct cell when selecting custom color cell with arrow keys
Correct cell is now set when selecting a custom color cell with arrow keys so that the custom coor is actually added to the selected cell (as with mouse events). Task-number: QTBUG-32054 Change-Id: Ic271a0be76070b4f5364954b2dfe464964c1380b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/widgets/dialogs/qcolordialog.cpp')
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index 79a71599c0..c08a034d9e 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -134,6 +134,7 @@ public:
signals:
void selected(int row, int col);
+ void currentChanged(int row, int col);
protected:
virtual void paintCell(QPainter *, int row, int col, const QRect&);
@@ -309,6 +310,8 @@ void QWellArray::setCurrent(int row, int col)
updateCell(oldRow, oldCol);
updateCell(curRow, curCol);
+
+ emit currentChanged(curRow, curCol);
}
/*
@@ -342,6 +345,7 @@ void QWellArray::setSelected(int row, int col)
void QWellArray::focusInEvent(QFocusEvent*)
{
updateCell(curRow, curCol);
+ emit currentChanged(curRow, curCol);
}
void QWellArray::setCellBrush(int row, int col, const QBrush &b)
@@ -1426,11 +1430,15 @@ void QColorDialogPrivate::_q_newColorTypedIn(QRgb rgb)
lp->setCol(h, s, v);
}
+void QColorDialogPrivate::_q_nextCustom(int r, int c)
+{
+ nextCust = r + 2 * c;
+}
+
void QColorDialogPrivate::_q_newCustom(int r, int c)
{
const int i = r + 2 * c;
setCurrentColor(QColorDialogOptions::customColor(i));
- nextCust = i;
if (standard)
standard->setSelected(-1,-1);
}
@@ -1494,6 +1502,7 @@ void QColorDialogPrivate::init(const QColor &initial)
custom->setAcceptDrops(true);
q->connect(custom, SIGNAL(selected(int,int)), SLOT(_q_newCustom(int,int)));
+ q->connect(custom, SIGNAL(currentChanged(int,int)), SLOT(_q_nextCustom(int,int)));
lblCustomColors = new QLabel(q);
#ifndef QT_NO_SHORTCUT
lblCustomColors->setBuddy(custom);