mirror of
https://github.com/Skycoder42/QHotkey.git
synced 2026-11-19 12:49:58 +03:00
155 lines
4.6 KiB
Plaintext
155 lines
4.6 KiB
Plaintext
/*!
|
|
@class QHotkey
|
|
|
|
Each instance of QHotkey represents one shortcut, i.e. one key + modifiers. These shortcuts, once registered, will be activated if the
|
|
user presses that combination - no matter in which application he currently is.
|
|
|
|
For more details and an example, check the main page.
|
|
|
|
@sa @ref index "Mainpage"
|
|
*/
|
|
|
|
/*!
|
|
@property QHotkey::registered
|
|
|
|
@default{`false`}
|
|
|
|
If a hotkey is registered, this means that it is set active in the OS and hotkey events will be send to the application.
|
|
If it is registered and the keys are pressed, the activated() signal will be emitted.
|
|
|
|
@warning Registering/Unregistering hotkeys on other threads but the main thread is allowed, but will block the calling
|
|
thread until the applications eventloop has the time to handle it. If the loop is not running, the function will block until
|
|
it does. This does not happen if used from the main thread.
|
|
|
|
@accessors{
|
|
@readAc{isRegistered()}
|
|
@writeAc{setRegistered()}
|
|
@notifyAc{registeredChanged()}
|
|
}
|
|
|
|
In addition to the normal accessors, a modification of the QHotkey::shortcut property can change this property, too.
|
|
|
|
@sa QHotkey::shortcut, QHotkey::activated, QHotkey::isKeyCaptured
|
|
*/
|
|
|
|
/*!
|
|
@property QHotkey::shortcut
|
|
|
|
@default{`QKeySequence()` (`Qt::Key_unknown` + `Qt::NoModifier`)}
|
|
|
|
Holds the shortcut this hotkey will be registered on. It can be used as QKeySequence or as a combination of
|
|
a Qt::Key and Qt::KeyboardModifiers. All write-accessors specifiy an additional parameter to immediatly register
|
|
the hotkey.
|
|
|
|
@note Since the operating systems do not support hotkeys that consist of multiple key-combinations in a sequence,
|
|
only the first key/modifier combination of a QKeySequence will be used.
|
|
|
|
@warning changing the shortcut on other threads but the main thread is allowed, but will block the calling
|
|
thread until the applications eventloop has the time to handle it. If the loop is not running, the function will block until
|
|
it does. This does not happen if used from the main thread.
|
|
|
|
@accessors{
|
|
@readAc{
|
|
<b>shortcut()</b><br/>
|
|
keyCode()<br/>
|
|
modifiers()
|
|
}
|
|
@writeAc{
|
|
<b>setShortcut(const QKeySequence &, bool)</b><br/>
|
|
setShortcut(Qt::Key, Qt::KeyboardModifiers, bool)
|
|
}
|
|
}
|
|
|
|
@sa QHotkey::registered, QHotkey::isKeyCaptured
|
|
*/
|
|
|
|
/*!
|
|
@typedef QHotkey::NativeShortcut
|
|
|
|
<table>
|
|
<tr>
|
|
<th>Member</th>
|
|
<th>Details</th>
|
|
</tr>
|
|
<tr>
|
|
<td>first</td>
|
|
<td>The keycode of the key to be pressed</td>
|
|
</tr>
|
|
<tr>
|
|
<td>second</td>
|
|
<td>The modifiers that have to be pressed together with the key</td>
|
|
</tr>
|
|
</table>
|
|
|
|
The NativeShortcut is used internally only and holds the native keycode and modifiers, after they have been translated
|
|
from Qt::Key and Qt::Modifiers into the native ones.
|
|
*/
|
|
|
|
/*!
|
|
@fn QHotkey::QHotkey(QObject *)
|
|
|
|
@overload
|
|
@param parent The parent object
|
|
|
|
@overloads{
|
|
@povElem{QHotkey::QHotkey(QObject *)}
|
|
@ovElem{QHotkey::QHotkey(const QKeySequence &, bool, QObject *)}
|
|
@ovElem{QHotkey::QHotkey(Qt::Key, Qt::KeyboardModifiers, bool, QObject *)}
|
|
}
|
|
*/
|
|
|
|
/*!
|
|
@fn QHotkey::QHotkey(const QKeySequence &, bool, QObject *)
|
|
|
|
@overload
|
|
@param parent The parent object
|
|
@param shortcut The shortcut this hotkey should be registered for
|
|
@param autoRegister Specifies, whether the hotkey should be automatically registered or not
|
|
|
|
@overloads{
|
|
@povElem{QHotkey::QHotkey(QObject *)}
|
|
@ovElem{QHotkey::QHotkey(const QKeySequence &, bool, QObject *)}
|
|
@ovElem{QHotkey::QHotkey(Qt::Key, Qt::KeyboardModifiers, bool, QObject *)}
|
|
}
|
|
|
|
@sa QHotkey::shortcut, QHotkey::registered
|
|
*/
|
|
|
|
/*!
|
|
@fn QHotkey::QHotkey(Qt::Key, Qt::KeyboardModifiers, bool, QObject *)
|
|
|
|
@overload
|
|
@param parent The parent object
|
|
@param key The key this hotkey should be registered for
|
|
@param modifiers The modifiers that have to be pressed together with the `key`
|
|
@param autoRegister Specifies, whether the hotkey should be automatically registered or not
|
|
|
|
@overloads{
|
|
@povElem{QHotkey::QHotkey(QObject *)}
|
|
@ovElem{QHotkey::QHotkey(const QKeySequence &, bool, QObject *)}
|
|
@ovElem{QHotkey::QHotkey(Qt::Key, Qt::KeyboardModifiers, bool, QObject *)}
|
|
}
|
|
|
|
@sa QHotkey::shortcut, QHotkey::registered
|
|
*/
|
|
|
|
/*!
|
|
@fn QHotkey::~QHotkey
|
|
|
|
If the hotkey is still registered on destruction, it will automatically unregister itself.
|
|
|
|
@warning If using a hotkey on a thread other than the main thread, make shure the QApplication is still running it's eventloop.
|
|
Otherwise your application will hang up.
|
|
|
|
@sa QHotkey::registered
|
|
*/
|
|
|
|
/*!
|
|
@fn QHotkey::activated
|
|
|
|
This signal can only be emitted if Hotkey::registered is set to true (with a valid key-sequence). The signal will always be emitted
|
|
from the thread this instance lives on.
|
|
|
|
@note This is a private signal. It can be used in signal connections but cannot be emitted by the user.
|
|
*/
|