mirror of
https://github.com/fergalmoran/flameshot.git
synced 2026-01-07 01:23:58 +00:00
Toggle panel with Space while grabbing a color
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -34,6 +34,7 @@ public:
|
||||
|
||||
signals:
|
||||
void colorChanged(const QColor &c);
|
||||
void togglePanel();
|
||||
|
||||
public slots:
|
||||
void updateColor(const QColor &c);
|
||||
|
||||
Reference in New Issue
Block a user