![]() |
Mapper
0.9.0
API documentation
|
A class that helps to deal efficiently with platform and localization issues of modifier keys. More...
#include <modifier_key.h>
Public Member Functions | |
ModifierKey (Qt::KeyboardModifiers keys) | |
Constructs a new ModifierKey for the given combination of KeyboardModifiers. More... | |
ModifierKey (Qt::Key key) | |
Constructs a new ModifierKey for the given key. More... | |
operator QString () const | |
Returns a string representation for user interface purposes. More... | |
Static Public Member Functions | |
static const ModifierKey & | alt () |
Returns a shared Alt modifier key. More... | |
static const ModifierKey & | control () |
Returns a shared Control modifier key. More... | |
static const ModifierKey & | controlShift () |
Returns a shared Control+Shift modifier key. More... | |
static const ModifierKey & | meta () |
Returns a shared Meta modifier key. More... | |
static const ModifierKey & | shift () |
Returns a shared Shift modifier key. More... | |
static const ModifierKey & | space () |
Returns a shared Space key. More... | |
static const ModifierKey & | return_key () |
Returns a shared Return key. More... | |
static const ModifierKey & | backspace () |
Returns a shared Backspace key. More... | |
static const ModifierKey & | escape () |
Returns a shared Escape modifier key. More... | |
Protected Member Functions | |
ModifierKey (int key) | |
Constructs a new ModifierKey for the given key. More... | |
A class that helps to deal efficiently with platform and localization issues of modifier keys.
It is based on QKeySequence::toString(QKeySequence::NativeText) which provides localization and deals with swapping Ctrl and Cmd on Mac OS X. In contrast to QKeySequence, ModifierKey has an implicit operator for casting to QString, and it removes the trailing '+' from pseudo key sequences which consist of modifier keys only. Static methods provide efficient translations of the pure modifier keys.
For true QKeySequences, call QKeySequence::toString(QKeySequence::NativeText) directly.
On Windows and Linux, the keys will be displayed as word ("Shift" etc.). On OS X, the keys will be displayed as graphical symbols ("⇧", i.e. Unicode character U+21E7, etc.).
Synopsis:
QString text = tr("%1+Click to add a point.").arg(ModifierKey::control()); QString more = tr("%1+Click to select a point.").arg(ModifierKey(Qt::ALT + Qt::ShiftModifier)); // BUT: QString help = help_action.shortcut().toString(QKeySequence::NativeText);
|
explicitprotected |
Constructs a new ModifierKey for the given key.
|
explicit |
Constructs a new ModifierKey for the given combination of KeyboardModifiers.
|
explicit |
Constructs a new ModifierKey for the given key.
|
static |
Returns a shared Alt modifier key.
|
static |
Returns a shared Backspace key.
|
static |
Returns a shared Control modifier key.
|
static |
Returns a shared Control+Shift modifier key.
|
static |
Returns a shared Escape modifier key.
|
static |
Returns a shared Meta modifier key.
|
inline |
Returns a string representation for user interface purposes.
This operator is intended to be used for implicit type casts.
|
static |
Returns a shared Return key.
|
static |
Returns a shared Shift modifier key.
|
static |
Returns a shared Space key.