aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/imports/qtquick2/plugins.qmltypes3
-rw-r--r--src/quick/util/qquickshortcut.cpp27
-rw-r--r--src/quick/util/qquickshortcut_p.h6
3 files changed, 28 insertions, 8 deletions
diff --git a/src/imports/qtquick2/plugins.qmltypes b/src/imports/qtquick2/plugins.qmltypes
index f0645213b0..b11906ee09 100644
--- a/src/imports/qtquick2/plugins.qmltypes
+++ b/src/imports/qtquick2/plugins.qmltypes
@@ -3478,7 +3478,8 @@ Module {
exports: ["QtQuick/Shortcut 2.5", "QtQuick/Shortcut 2.6"]
exportMetaObjectRevisions: [0, 1]
Property { name: "sequence"; type: "QVariant" }
- Property { name: "sequenceString"; revision: 1; type: "string"; isReadonly: true }
+ Property { name: "nativeText"; revision: 1; type: "string"; isReadonly: true }
+ Property { name: "portableText"; revision: 1; type: "string"; isReadonly: true }
Property { name: "enabled"; type: "bool" }
Property { name: "autoRepeat"; type: "bool" }
Property { name: "context"; type: "Qt::ShortcutContext" }
diff --git a/src/quick/util/qquickshortcut.cpp b/src/quick/util/qquickshortcut.cpp
index 9f32b6c180..e6f66f7bf1 100644
--- a/src/quick/util/qquickshortcut.cpp
+++ b/src/quick/util/qquickshortcut.cpp
@@ -134,20 +134,37 @@ void QQuickShortcut::setSequence(const QVariant &sequence)
}
/*!
- \qmlproperty string QtQuick::Shortcut::sequenceString
+ \qmlproperty string QtQuick::Shortcut::nativeText
\since 5.6
- This property provides the shortcut's key sequence as a string,
- for display purposes (tooltips, for example).
+ This property provides the shortcut's key sequence as a platform specific
+ string. This means that it will be shown translated, and on OS X it will
+ resemble a key sequence from the menu bar. It is best to display this text
+ to the user (for example, on a tooltip).
- \sa sequence
+ \sa sequence, portableText
*/
-QString QQuickShortcut::sequenceString() const
+QString QQuickShortcut::nativeText() const
{
return m_shortcut.toString(QKeySequence::NativeText);
}
/*!
+ \qmlproperty string QtQuick::Shortcut::portableText
+ \since 5.6
+
+ This property provides the shortcut's key sequence as a string in a
+ "portable" format, suitable for reading and writing to a file. In many
+ cases, it will look similar to the native text on Windows and X11.
+
+ \sa sequence, nativeText
+*/
+QString QQuickShortcut::portableText() const
+{
+ return m_shortcut.toString(QKeySequence::PortableText);
+}
+
+/*!
\qmlproperty bool QtQuick::Shortcut::enabled
This property holds whether the shortcut is enabled.
diff --git a/src/quick/util/qquickshortcut_p.h b/src/quick/util/qquickshortcut_p.h
index db02f8afae..d8a233af78 100644
--- a/src/quick/util/qquickshortcut_p.h
+++ b/src/quick/util/qquickshortcut_p.h
@@ -57,7 +57,8 @@ class QQuickShortcut : public QObject, public QQmlParserStatus
Q_OBJECT
Q_INTERFACES(QQmlParserStatus)
Q_PROPERTY(QVariant sequence READ sequence WRITE setSequence NOTIFY sequenceChanged FINAL)
- Q_PROPERTY(QString sequenceString READ sequenceString NOTIFY sequenceChanged FINAL REVISION 1)
+ Q_PROPERTY(QString nativeText READ nativeText NOTIFY sequenceChanged FINAL REVISION 1)
+ Q_PROPERTY(QString portableText READ portableText NOTIFY sequenceChanged FINAL REVISION 1)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL)
Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY autoRepeatChanged FINAL)
Q_PROPERTY(Qt::ShortcutContext context READ context WRITE setContext NOTIFY contextChanged FINAL)
@@ -69,7 +70,8 @@ public:
QVariant sequence() const;
void setSequence(const QVariant &sequence);
- Q_REVISION(1) QString sequenceString() const;
+ QString nativeText() const;
+ QString portableText() const;
bool isEnabled() const;
void setEnabled(bool enabled);