made NativeShortcut private, some mods

This commit is contained in:
Skycoder42
2016-02-06 10:23:12 +01:00
parent 7f586d1c62
commit 45efa316a5
5 changed files with 93 additions and 77 deletions
+42 -1
View File
@@ -12,13 +12,16 @@ public:
QHotkeyPrivate();//singleton!!!
~QHotkeyPrivate();
static QHotkeyPrivate *instance();
// QAbstractNativeEventFilter interface
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
QHotkey::NativeShortcut nativeShortcut(Qt::Key keycode, Qt::KeyboardModifiers modifiers);
bool hasShortcut(Qt::Key keycode, Qt::KeyboardModifiers modifiers);
bool addShortcut(QHotkey *hotkey);
bool removeShortcut(QHotkey *hotkey);//platform implement
bool removeShortcut(QHotkey *hotkey);
private:
QMutex mutex;
@@ -33,4 +36,42 @@ private:
bool unregisterShortcut(QHotkey::NativeShortcut shortcut);//platform implement
};
uint qHash(QHotkey::NativeShortcut key, uint seed = 0);
// ---------- QHotkey::NativeShortcut implementation ----------
inline QHotkey::NativeShortcut::NativeShortcut() :
key(0),
mods(0)
{}
inline QHotkey::NativeShortcut::NativeShortcut(const QHotkey::NativeShortcut &other) :
key(other.key),
mods(other.mods)
{}
inline QHotkey::NativeShortcut &QHotkey::NativeShortcut::operator =(const QHotkey::NativeShortcut &other)
{
this->key = other.key;
this->mods = other.mods;
return (*this);
}
inline bool QHotkey::NativeShortcut::isValid() const
{
return (this->key != 0);
}
inline bool QHotkey::NativeShortcut::operator==(const QHotkey::NativeShortcut &other) const
{
return (this->key == other.key && this->mods == other.mods);
}
inline uint qHash(QHotkey::NativeShortcut key, uint seed)
{
return qHash(key.key ^ key.mods, seed);
}
#endif // QHOTKEY_P_H