mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Added Escape hotkey to clear selection in photo editor.
This commit is contained in:
parent
3ee3919d50
commit
a93ec9c2c2
2 changed files with 10 additions and 3 deletions
|
@ -251,8 +251,15 @@ void ItemBase::actionDuplicate() {
|
|||
}
|
||||
}
|
||||
|
||||
void ItemBase::keyPressEvent(QKeyEvent *event) {
|
||||
handleActionKey(event);
|
||||
void ItemBase::keyPressEvent(QKeyEvent *e) {
|
||||
if (e->key() == Qt::Key_Escape) {
|
||||
if (const auto s = scene()) {
|
||||
s->clearSelection();
|
||||
s->clearFocus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
handleActionKey(e);
|
||||
}
|
||||
|
||||
void ItemBase::handleActionKey(not_null<QKeyEvent*> e) {
|
||||
|
|
|
@ -61,7 +61,7 @@ protected:
|
|||
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
|
||||
using Action = void(ItemBase::*)();
|
||||
void performForSelectedItems(Action action);
|
||||
|
|
Loading…
Add table
Reference in a new issue