-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshortcuts.h
51 lines (34 loc) · 1006 Bytes
/
shortcuts.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef SHORTCUTS_H
#define SHORTCUTS_H
#include <QObject>
#include <QCoreApplication>
#include <QKeySequence>
#include "player.h"
struct ShortcutData
{
QKeySequence KeySequence;
QObject *Context;
const char *Slot;
};
Q_DECLARE_METATYPE(ShortcutData);
class Shortcuts : public QObject
{
Q_OBJECT
public:
Shortcuts(const Shortcuts&) = delete; // disable copy for singleton
static Shortcuts *instance();
static QObject *qmlInstance(QQmlEngine *engine, QJSEngine *scriptEngine);
bool eventFilter(QObject *obj, QEvent *e);
// https://www.qtcentre.org/threads/8392-How-to-declare-SLOT-as-a-parameter-to-member-function
void add(QKeySequence xKeySequence, QObject *xContext, const char *Slot); // const QMetaMethod &method
void remove();
public slots:
//void ready();
signals:
void activated();
private:
bool mAlreadySent = false;
QVector<ShortcutData> mShortcuts;
explicit Shortcuts(QObject *parent = nullptr);
};
#endif // SHORTCUTS_H