mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 19:47:46 -07:00
refactored deck editor UI key shortcuts
The global shortcuts were removed in favor of key events which are only triggered when a widget has focus. This is necessary to allow different widgets to react differently to the 'enter' key. The current key configuration is: search edit focused: * left/right: decrease/increase card count for selected database card * enter: add selected card to deck * ctrl-enter: add selected card to deck sideboard * ctrl-left/right: decrease/increase card count in sideboard for selected card database focused: the same as with search edit. deckview focused: * left/right: decrease/increase card count for selected deckview card * enter: increase count for selected deckview card * delete/backspace: delete selected card from deck
This commit is contained in:
parent
f6e9676c75
commit
2b7ea0c983
9 changed files with 212 additions and 30 deletions
30
cockatrice/src/keysignals.h
Normal file
30
cockatrice/src/keysignals.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#include <QObject>
|
||||
#include <QEvent>
|
||||
|
||||
class KeySignals : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
bool filterDeleteOn;
|
||||
bool filterLROn;
|
||||
|
||||
signals:
|
||||
void onEnter();
|
||||
void onCtrlEnter();
|
||||
void onLeft();
|
||||
void onCtrlLeft();
|
||||
void onRight();
|
||||
void onCtrlRight();
|
||||
void onDelete();
|
||||
|
||||
protected:
|
||||
virtual bool eventFilter(QObject *, QEvent *event);
|
||||
|
||||
public:
|
||||
KeySignals()
|
||||
: filterDeleteOn(true)
|
||||
, filterLROn(true)
|
||||
{}
|
||||
void filterDelete(bool on) { filterDeleteOn = on; }
|
||||
void filterLeftRight(bool on) { filterLROn = on; }
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue