summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@theqtcompany.com>2015-08-28 13:37:31 +0200
committerRichard Moe Gustavsen <richard.gustavsen@theqtcompany.com>2015-08-31 10:20:56 +0000
commitf770dbe9d38214a37e12adb591498dcd1ad0293e (patch)
tree6b0116d4a0cda3a01de348453ebf191c3831d1d6
parent3ffd2e4ee3229e714eed497c1ae3a3bbbcabe8cf (diff)
downloadqtquickcontrols-f770dbe9d38214a37e12adb591498dcd1ad0293e.tar.gz
iOS: add shortcuts to edit menu items
On iOS, the virtual keyboard contains buttons for standard edit actions like cut, copy and paste. When triggered, we send key events that corresponds to the shortcut sequence for those actions. With this patch, you can then trigger the menu items directly from the virtual keyboard. Change-Id: I350f74942b9ae443387bb253aeafa053e7544f7e Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
-rw-r--r--src/controls/Private/EditMenu_ios.qml10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/controls/Private/EditMenu_ios.qml b/src/controls/Private/EditMenu_ios.qml
index 7b0787f0..94c4617a 100644
--- a/src/controls/Private/EditMenu_ios.qml
+++ b/src/controls/Private/EditMenu_ios.qml
@@ -34,8 +34,8 @@
**
****************************************************************************/
-import QtQuick 2.1
-import QtQuick.Controls 1.1
+import QtQuick 2.2
+import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.1
import QtQuick.Controls.Private 1.0
@@ -46,6 +46,7 @@ Item {
property Component defaultMenu: Menu {
MenuItem {
text: qsTr("Cut")
+ shortcut: StandardKey.Cut
visible: !input.readOnly && selectionStart !== selectionEnd
onTriggered: {
cut();
@@ -54,6 +55,7 @@ Item {
}
MenuItem {
text: qsTr("Copy")
+ shortcut: StandardKey.Copy
visible: selectionStart !== selectionEnd
onTriggered: {
copy();
@@ -62,21 +64,25 @@ Item {
}
MenuItem {
text: qsTr("Paste")
+ shortcut: StandardKey.Paste
visible: input.canPaste
onTriggered: paste();
}
MenuItem {
text: qsTr("Delete")
+ shortcut: StandardKey.Delete
visible: !input.readOnly && selectionStart !== selectionEnd
onTriggered: remove(selectionStart, selectionEnd)
}
MenuItem {
text: qsTr("Select")
+ shortcut: StandardKey.Select
visible: selectionStart === selectionEnd && input.length > 0
onTriggered: selectWord();
}
MenuItem {
text: qsTr("Select All")
+ shortcut: StandardKey.SelectAll
visible: !(selectionStart === 0 && selectionEnd === length)
onTriggered: selectAll();
}