modified native hotkey to allow 0 as valid key

This commit is contained in:
Skycoder42
2016-12-04 16:03:12 +01:00
parent 49da8b1c5c
commit 5d770d60a0
4 changed files with 68 additions and 13 deletions
+19 -1
View File
@@ -19,7 +19,22 @@ class QHotkey : public QObject
public:
//! Defines shortcut with native keycodes
typedef QPair<quint32, quint32> NativeShortcut;
class NativeShortcut {
public:
quint32 key;
quint32 modifier;
NativeShortcut();
NativeShortcut(quint32 key, quint32 modifier = 0);
bool isValid() const;
bool operator ==(const NativeShortcut &other) const;
bool operator !=(const NativeShortcut &other) const;
private:
bool valid;
};
//! Constructor
explicit QHotkey(QObject *parent = Q_NULLPTR);
@@ -65,6 +80,9 @@ private:
bool registered;
};
uint qHash(const QHotkey::NativeShortcut &key);
uint qHash(const QHotkey::NativeShortcut &key, uint seed);
Q_DECLARE_LOGGING_CATEGORY(logQHotkey)
#endif // QHOTKEY_H