diff options
author | Shawn Rutledge <shawn.rutledge@theqtcompany.com> | 2015-08-07 10:52:36 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@theqtcompany.com> | 2015-09-03 08:18:20 +0000 |
commit | 8b09653cb22807f09ec4e6c0ffc7dcf7f11bc1a0 (patch) | |
tree | 0d9e717ce1b2874d7a29da0df002980b0955c481 /src/quick/util/qquickshortcut.cpp | |
parent | 149ece7a0cfb4fc90fe4544379ee2772fde881fd (diff) |
Shortcut: add sequenceString property
If you set sequence to a StandardKey, then read back the property,
you will get an int, which is not suitable for display.
Now you can use sequenceString for tooltips, preference dialogs
for setting shortcuts, and such.
[ChangeLog][QtQuick] Added Shortcut.sequenceString property to read
back the key sequence as a displayable string
Change-Id: I63ee46f8a2c2da1b1c803282baa894fb1667fe67
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Diffstat (limited to 'src/quick/util/qquickshortcut.cpp')
-rw-r--r-- | src/quick/util/qquickshortcut.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/quick/util/qquickshortcut.cpp b/src/quick/util/qquickshortcut.cpp index 36c6933af4..9f32b6c180 100644 --- a/src/quick/util/qquickshortcut.cpp +++ b/src/quick/util/qquickshortcut.cpp @@ -134,6 +134,20 @@ void QQuickShortcut::setSequence(const QVariant &sequence) } /*! + \qmlproperty string QtQuick::Shortcut::sequenceString + \since 5.6 + + This property provides the shortcut's key sequence as a string, + for display purposes (tooltips, for example). + + \sa sequence +*/ +QString QQuickShortcut::sequenceString() const +{ + return m_shortcut.toString(QKeySequence::NativeText); +} + +/*! \qmlproperty bool QtQuick::Shortcut::enabled This property holds whether the shortcut is enabled. |