1
#ifndef CSM_PREFS_SHORTCUT_EVENT_HANDLER_H
2
#define CSM_PREFS_SHORTCUT_EVENT_HANDLER_H
16
/// Users of this class should install it as an event handler
17
class ShortcutEventHandler : public QObject
23
ShortcutEventHandler(QObject* parent);
25
void addShortcut(Shortcut* shortcut);
26
void removeShortcut(Shortcut* shortcut);
30
bool eventFilter(QObject* watched, QEvent* event);
34
typedef std::vector<Shortcut*> ShortcutList;
36
typedef std::map<QWidget*, QWidget*> WidgetMap;
37
typedef std::map<QWidget*, ShortcutList> ShortcutMap;
46
void updateParent(QWidget* widget);
48
bool activate(QWidget* widget, unsigned int mod, unsigned int button);
50
bool deactivate(QWidget* widget, unsigned int mod, unsigned int button);
52
bool checkModifier(unsigned int mod, unsigned int button, Shortcut* shortcut, bool activate);
54
MatchResult match(unsigned int mod, unsigned int button, unsigned int value);
56
// Prefers Matches_WithMod and a larger number of buttons
57
static bool sort(const std::pair<MatchResult, Shortcut*>& left,
58
const std::pair<MatchResult, Shortcut*>& right);
60
WidgetMap mChildParentRelations;
61
ShortcutMap mWidgetShortcuts;
65
void widgetDestroyed();