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
The GlobalShortcut class provides a global shortcut aka "hotkey".
Definition GlobalShortcut.h:26
#define _GSC_CLASS
Definition gsc/global.h:35
Definition Application.h:10