Pass NativeShortcut by value (trivially copyable)

This commit is contained in:
Shatur95
2020-10-17 01:07:57 +03:00
parent 2a87965ed6
commit 4bb901a41e
3 changed files with 15 additions and 15 deletions
+7 -7
View File
@@ -46,16 +46,16 @@ public:
bool isValid() const;
//! Equality operator
bool operator ==(const NativeShortcut &other) const;
bool operator ==(NativeShortcut other) const;
//! Inequality operator
bool operator !=(const NativeShortcut &other) const;
bool operator !=(NativeShortcut other) const;
private:
bool valid;
};
//! Adds a global mapping of a key sequence to a replacement native shortcut
static void addGlobalMapping(const QKeySequence &shortcut, const NativeShortcut &nativeShortcut);
static void addGlobalMapping(const QKeySequence &shortcut, NativeShortcut nativeShortcut);
//! Checks if global shortcuts are supported by the current platform
static bool isPlatformSupported();
@@ -67,7 +67,7 @@ public:
//! Constructs a hotkey with a key and modifiers and optionally registers it
explicit QHotkey(Qt::Key keyCode, Qt::KeyboardModifiers modifiers, bool autoRegister = false, QObject *parent = nullptr);
//! Constructs a hotkey from a native shortcut and optionally registers it
explicit QHotkey(const NativeShortcut &shortcut, bool autoRegister = false, QObject *parent = nullptr);
explicit QHotkey(NativeShortcut shortcut, bool autoRegister = false, QObject *parent = nullptr);
~QHotkey() override;
//! @readAcFn{QHotkey::registered}
@@ -94,7 +94,7 @@ public slots:
bool resetShortcut();
//! Set this hotkey to a native shortcut
bool setNativeShortcut(NativeShortcut nativeShortcut, bool autoRegister = false);
bool setNativeShortcut(QHotkey::NativeShortcut nativeShortcut, bool autoRegister = false);
signals:
//! Will be emitted if the shortcut is pressed
@@ -114,8 +114,8 @@ private:
bool _registered;
};
uint QHOTKEY_SHARED_EXPORT qHash(const QHotkey::NativeShortcut &key);
uint QHOTKEY_SHARED_EXPORT qHash(const QHotkey::NativeShortcut &key, uint seed);
uint QHOTKEY_SHARED_EXPORT qHash(QHotkey::NativeShortcut key);
uint QHOTKEY_SHARED_EXPORT qHash(QHotkey::NativeShortcut key, uint seed);
QHOTKEY_SHARED_EXPORT Q_DECLARE_LOGGING_CATEGORY(logQHotkey)