The GlobalShortcut class provides a global shortcut aka "hotkey".
More...
#include <GlobalShortcut.h>
|
bool | enabled |
| Gets whether the shortcut is enabled.
|
|
bool | valid |
| Gets whether the shortcut was successfully set up.
|
|
QKeySequence | sequence |
| the shortcut key sequence
|
|
bool | global |
|
The GlobalShortcut class provides a global shortcut aka "hotkey".
A global shortcut triggers even if the application is not active. This makes it easy to implement applications that react to certain shortcuts still if some other application is active or if the application is for example minimized to the system tray.
Example usage:
connect(shortcut, SIGNAL(
activated()), window, SLOT(toggleVisibility()));
shortcut->setShortcut(QKeySequence("Ctrl+Shift+F12"));
The GlobalShortcut class provides a global shortcut aka "hotkey".
Definition GlobalShortcut.h:27
void activated(GlobalShortcut *self)
This signal is emitted when the user types the shortcut's key sequence.
◆ GlobalShortcut() [1/2]
sf::GlobalShortcut::GlobalShortcut |
( |
QObject * |
parent = nullptr | ) |
|
|
explicit |
◆ GlobalShortcut() [2/2]
sf::GlobalShortcut::GlobalShortcut |
( |
const QKeySequence & |
sequence, |
|
|
QObject * |
parent = nullptr |
|
) |
| |
|
explicit |
◆ ~GlobalShortcut()
sf::GlobalShortcut::~GlobalShortcut |
( |
| ) |
|
|
override |
◆ activated
This signal is emitted when the user types the shortcut's key sequence.
- See also
- sequence
◆ autoRepeat()
bool sf::GlobalShortcut::autoRepeat |
( |
| ) |
const |
Gets if the shortcut auto repeats.
- Returns
- True when auto repeating.
◆ isEnabled()
bool sf::GlobalShortcut::isEnabled |
( |
| ) |
const |
◆ isGlobal()
bool sf::GlobalShortcut::isGlobal |
( |
| ) |
const |
Gets if the shortcut only is global.
- Returns
- True when global
◆ isValid()
bool sf::GlobalShortcut::isValid |
( |
| ) |
const |
◆ sequence()
QKeySequence sf::GlobalShortcut::sequence |
( |
| ) |
const |
◆ setAutoRepeat()
void sf::GlobalShortcut::setAutoRepeat |
( |
bool |
on | ) |
|
Sets if the shortcut should auto repeat.
◆ setDisabled
void sf::GlobalShortcut::setDisabled |
( |
bool |
disabled = true | ) |
|
|
slot |
Sets the shortcut disabled.
- See also
- enabled
◆ setEnabled
void sf::GlobalShortcut::setEnabled |
( |
bool |
enabled = true | ) |
|
|
slot |
Sets the shortcut enabled.
- See also
- enabled
◆ setGlobal()
void sf::GlobalShortcut::setGlobal |
( |
bool |
global = true | ) |
|
Makes the shortcut grab a global key.
By default it is false and the shortcuts only respond when the application has focus. When the key is global the key is processed by this application and no others.
◆ setSequence()
bool sf::GlobalShortcut::setSequence |
( |
const QKeySequence & |
sequence | ) |
|
◆ enabled
sf::GlobalShortcut::enabled |
|
readwrite |
Gets whether the shortcut is enabled.
A disabled shortcut does not get activated. The default value is true
.
- See also
- setEnabled(), setDisabled()
◆ global
bool sf::GlobalShortcut::global |
|
readwrite |
◆ sequence
sf::GlobalShortcut::sequence |
|
readwrite |
the shortcut key sequence
sets the shortcut key sequence.
Notice that corresponding key press and release events are not delivered for registered global shortcuts even if they are disabled. Also, comma separated key sequences are not supported. Only the first part is used:
qxtShortcut->setShortcut(QKeySequence("Ctrl+Alt+A,Ctrl+Alt+B"));
Q_ASSERT(qxtShortcut->sequence() == QKeySequence("Ctrl+Alt+A"));
- See also
- setSequence()
-
sequence()
◆ valid
sf::GlobalShortcut::valid |
|
read |
Gets whether the shortcut was successfully set up.
The documentation for this class was generated from the following file: