diff --git a/src/widgets/panel/colorpickerwidget.cpp b/src/widgets/panel/colorpickerwidget.cpp index 91bfa7cc..75bf7762 100644 --- a/src/widgets/panel/colorpickerwidget.cpp +++ b/src/widgets/panel/colorpickerwidget.cpp @@ -69,7 +69,8 @@ ColorPickerWidget::ColorPickerWidget(QPixmap *p, QWidget *parent) : QString modifier = isDark ? PathInfo::whiteConfigIconPath() : PathInfo::blackConfigIconPath(); QIcon grabIcon(modifier + "colorize.png"); - m_colorGrabButton = new QPushButton(grabIcon, tr("Grab Color")); + m_colorGrabButton = new QPushButton(grabIcon, ""); + updateGrabButton(false); connect(m_colorGrabButton, &QPushButton::pressed, this, &ColorPickerWidget::colorGrabberActivated); m_layout->addWidget(m_colorGrabButton); @@ -105,6 +106,7 @@ void ColorPickerWidget::colorGrabberActivated() { m_eventFilter = new QColorPickingEventFilter(this, this); } installEventFilter(m_eventFilter); + updateGrabButton(true); } void ColorPickerWidget::releaseColorGrab() { @@ -113,6 +115,7 @@ void ColorPickerWidget::releaseColorGrab() { releaseMouse(); releaseKeyboard(); setFocus(); + updateGrabButton(false); } QColor ColorPickerWidget::grabPixmapColor(const QPoint &p) { @@ -155,3 +158,11 @@ bool ColorPickerWidget::handleMouseMove(QMouseEvent *e) { updateColorNoWheel(grabPixmapColor(e->globalPos())); return true; } + +void ColorPickerWidget::updateGrabButton(const bool activated) { + if (activated) { + m_colorGrabButton->setText(tr("Press ESC to cancel")); + } else { + m_colorGrabButton->setText(tr("Grab Color")); + } +} diff --git a/src/widgets/panel/colorpickerwidget.h b/src/widgets/panel/colorpickerwidget.h index 07a56db5..6cd5544a 100644 --- a/src/widgets/panel/colorpickerwidget.h +++ b/src/widgets/panel/colorpickerwidget.h @@ -53,6 +53,8 @@ private: bool handleMouseButtonPressed(QMouseEvent *e); bool handleMouseMove(QMouseEvent *e); + void updateGrabButton(const bool activated); + QVBoxLayout *m_layout; QPushButton *m_colorGrabButton; color_widgets::ColorWheel *m_colorWheel;