diff --git a/src/widgets/capture/capturewidget.cpp b/src/widgets/capture/capturewidget.cpp index c891d13c..6fd44a26 100644 --- a/src/widgets/capture/capturewidget.cpp +++ b/src/widgets/capture/capturewidget.cpp @@ -540,11 +540,14 @@ void CaptureWidget::initPanel() { panelRect.setWidth(m_colorPicker->width() * 3); m_panel->setGeometry(panelRect); - ColorPickerWidget *colorPicker = new ColorPickerWidget(&m_context.screenshot); + ColorPickerWidget *colorPicker = + new ColorPickerWidget(&m_context.screenshot); connect(colorPicker, &ColorPickerWidget::colorChanged, this, &CaptureWidget::setDrawColor); connect(this, &CaptureWidget::colorChanged, colorPicker, &ColorPickerWidget::updateColor); + connect(colorPicker, &ColorPickerWidget::togglePanel, + m_panel, &UtilityPanel::toggle); colorPicker->colorChanged(m_context.color); m_panel->pushWidget(colorPicker); m_panel->pushWidget(new QUndoView(&m_undoStack, this)); diff --git a/src/widgets/panel/colorpickerwidget.cpp b/src/widgets/panel/colorpickerwidget.cpp index d2ffe736..91bfa7cc 100644 --- a/src/widgets/panel/colorpickerwidget.cpp +++ b/src/widgets/panel/colorpickerwidget.cpp @@ -125,7 +125,9 @@ QColor ColorPickerWidget::grabPixmapColor(const QPoint &p) { } bool ColorPickerWidget::handleKeyPress(QKeyEvent *e) { - if (e->key() == Qt::Key_Escape) { + if (e->key() == Qt::Key_Space) { + emit togglePanel(); + } else if (e->key() == Qt::Key_Escape) { releaseColorGrab(); updateColor(m_colorBackup); } else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) { diff --git a/src/widgets/panel/colorpickerwidget.h b/src/widgets/panel/colorpickerwidget.h index 6351b8e1..07a56db5 100644 --- a/src/widgets/panel/colorpickerwidget.h +++ b/src/widgets/panel/colorpickerwidget.h @@ -34,6 +34,7 @@ public: signals: void colorChanged(const QColor &c); + void togglePanel(); public slots: void updateColor(const QColor &c);