diff options
-rw-r--r-- | src/widgets/dialogs/qcolordialog.cpp | 19 | ||||
-rw-r--r-- | src/widgets/dialogs/qcolordialog_p.h | 1 |
2 files changed, 13 insertions, 7 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index f7f45c74ac..5b119cf84d 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -1587,11 +1587,16 @@ void QColorDialogPrivate::_q_pickScreenColor() buttons->setDisabled(true); screenColorPickerButton->setDisabled(true); - q->setCurrentColor(grabScreenColor(QCursor::pos())); - lblScreenColorInfo->setText(QColorDialog::tr("Cursor at %1, %2, color: %3\nPress ESC to cancel") - .arg(QCursor::pos().x()) - .arg(QCursor::pos().y()) - .arg(q->currentColor().name())); + const QPoint globalPos = QCursor::pos(); + q->setCurrentColor(grabScreenColor(globalPos)); + updateColorLabelText(globalPos); +} + +void QColorDialogPrivate::updateColorLabelText(const QPoint &globalPos) +{ + lblScreenColorInfo->setText(QColorDialog::tr("Cursor at %1, %2\nPress ESC to cancel") + .arg(globalPos.x()) + .arg(globalPos.y())); } void QColorDialogPrivate::releaseColorPicking() @@ -2196,8 +2201,8 @@ bool QColorDialogPrivate::handleColorPickingMouseMove(QMouseEvent *e) // QTBUG-39792, do not change standard, custom color selectors while moving as // otherwise it is not possible to pre-select a custom cell for assignment. setCurrentColor(color, ShowColor); - lblScreenColorInfo->setText(QColorDialog::tr("Cursor at %1, %2, color: %3\nPress ESC to cancel") - .arg(globalPos.x()).arg(globalPos.y()).arg(color.name())); + updateColorLabelText(globalPos); + return true; } diff --git a/src/widgets/dialogs/qcolordialog_p.h b/src/widgets/dialogs/qcolordialog_p.h index c2d6f48f49..7e6c8b1231 100644 --- a/src/widgets/dialogs/qcolordialog_p.h +++ b/src/widgets/dialogs/qcolordialog_p.h @@ -104,6 +104,7 @@ public: void _q_newCustom(int, int); void _q_newStandard(int, int); void _q_pickScreenColor(); + void updateColorLabelText(const QPoint &); void releaseColorPicking(); bool handleColorPickingMouseMove(QMouseEvent *e); bool handleColorPickingMouseButtonRelease(QMouseEvent *e); |