Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
GlobalShortcut.h
Go to the documentation of this file.
1#pragma once
2#include <QKeySequence>
3#include <QObject>
4#include <gsc/global.h>
5
6namespace sf
7{
8
25class _GSC_CLASS GlobalShortcut : public QObject
26{
27 Q_OBJECT
28 Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
29 Q_PROPERTY(bool valid READ isValid)
30 Q_PROPERTY(QKeySequence sequence READ sequence WRITE setSequence)
31 Q_PROPERTY(bool global READ isGlobal WRITE setGlobal)
32
33 public:
37 explicit GlobalShortcut(QObject* parent = nullptr);
38
42 explicit GlobalShortcut(const QKeySequence& sequence, QObject* parent = nullptr);
43
47 ~GlobalShortcut() override;
48
64 [[nodiscard]] QKeySequence sequence() const;
65
71 bool setSequence(const QKeySequence& sequence);
72
81 [[nodiscard]] bool isEnabled() const;
82
87 [[nodiscard]] bool isValid() const;
88
95 void setGlobal(bool global = true);
96
101 [[nodiscard]] bool isGlobal() const;
102
107 [[nodiscard]] bool autoRepeat() const;
108
112 void setAutoRepeat(bool on);
113
117 struct Private;
118
119 public Q_SLOTS:
120
125 void setEnabled(bool enabled = true);
126
131 void setDisabled(bool disabled = true);
132
133 public:
138 // ReSharper disable once CppFunctionIsNotImplemented
139 Q_SIGNAL void activated(GlobalShortcut* self);
140
141 private:
145 Private* _p;
146};
147
148}// namespace sf
GlobalShortcut(QObject *parent=nullptr)
Constructs a new GlobalShortcut with parent.
bool enabled
Gets whether the shortcut is enabled.
Definition GlobalShortcut.h:28
bool setSequence(const QKeySequence &sequence)
bool global
Definition GlobalShortcut.h:31
void setDisabled(bool disabled=true)
Sets the shortcut disabled.
bool isValid() const
QKeySequence sequence
the shortcut key sequence
Definition GlobalShortcut.h:30
void setEnabled(bool enabled=true)
Sets the shortcut enabled.
bool isEnabled() const
Q_SIGNAL void activated(GlobalShortcut *self)
This signal is emitted when the user types the shortcut's key sequence.
bool valid
Gets whether the shortcut was successfully set up.
Definition GlobalShortcut.h:29
void setAutoRepeat(bool on)
Sets if the shortcut should auto repeat.
void setGlobal(bool global=true)
Makes the shortcut grab a global key.
bool autoRepeat() const
Gets if the shortcut auto repeats.
bool isGlobal() const
Gets if the shortcut only is global.
#define _GSC_CLASS
Definition gsc/global.h:35
Definition Application.h:10