diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2013-06-27 13:31:34 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-03 12:30:22 +0200 |
commit | 17fe17d525ffde65fcbe88c6ade539ab8bca1772 (patch) | |
tree | dc380966d6fb3e090fe38ba56d2c308462065c8c /src/widgets/dialogs | |
parent | bc03e80f9a6686d67744045f4015623c6ee79c2a (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')
-rw-r--r-- | src/widgets/dialogs/qcolordialog.cpp | 11 | ||||
-rw-r--r-- | src/widgets/dialogs/qcolordialog.h | 1 | ||||
-rw-r--r-- | src/widgets/dialogs/qcolordialog_p.h | 1 |
3 files changed, 12 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); diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h index 80a31c4268..f6dc627a05 100644 --- a/src/widgets/dialogs/qcolordialog.h +++ b/src/widgets/dialogs/qcolordialog.h @@ -120,6 +120,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_addCustom()) Q_PRIVATE_SLOT(d_func(), void _q_newHsv(int h, int s, int v)) Q_PRIVATE_SLOT(d_func(), void _q_newColorTypedIn(QRgb rgb)) + Q_PRIVATE_SLOT(d_func(), void _q_nextCustom(int, int)) Q_PRIVATE_SLOT(d_func(), void _q_newCustom(int, int)) Q_PRIVATE_SLOT(d_func(), void _q_newStandard(int, int)) friend class QColorShower; diff --git a/src/widgets/dialogs/qcolordialog_p.h b/src/widgets/dialogs/qcolordialog_p.h index 900b38fc61..695e95d26c 100644 --- a/src/widgets/dialogs/qcolordialog_p.h +++ b/src/widgets/dialogs/qcolordialog_p.h @@ -98,6 +98,7 @@ public: void _q_newHsv(int h, int s, int v); void _q_newColorTypedIn(QRgb rgb); + void _q_nextCustom(int, int); void _q_newCustom(int, int); void _q_newStandard(int, int); |