summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@theqtcompany.com>2015-11-25 15:15:04 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2015-11-29 16:22:25 +0000
commita3ba1a532f92a933141d4671ce644053a0cb6fea (patch)
tree949dab9b0d94f6f1de4de00aa3f039036e6a683f
parent38fb5d03b6b5ab305479df530092f8a669b37e72 (diff)
downloadqtquickcontrols-a3ba1a532f92a933141d4671ce644053a0cb6fea.tar.gz
iOS: let platform plugin populate edit menus
When showing an edit menu on iOS, UIKit will always populate the menu with some default system menu items. This means that if controls e.g adds a menu item "cut" to the menu, it might appear twize since UIKit might add one as well. To avoid this, we filter away menu items added by Qt if we see that the shortcut assigned corresponds to one of the UIKit items. As such, we rely on the menu items in the edit menu to have shortcuts assigned. But this strategy turns out to have a flaw. A specific shortcut can only map to one control inside a window. So if a control creates a shortcut "copy", no-one else inside that window can do the same. So if you have several line edits, all with their own edit menu, you will end up with many menu items using the same shortcuts. And this will cause warnings and problems when Qt later tries to find a shortcut to trigger. Since it turns out the using shortcuts internally for our own controls is a bad idea in the first place (it steals away the possibility for the application to use them for something else), and since we're anyway moving into the direction of doing text editing directly from the platform plugin, this change will start by giving full control over the contents of the edit menu to the ios plugin. This will remove usage of shortcuts, and therefore fix the related problems in the same go. Change-Id: Ib8a6f54d444e756fee7328e06a4b83e778cb1022 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com> Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
-rw-r--r--src/controls/Private/EditMenu_ios.qml43
1 files changed, 1 insertions, 42 deletions
diff --git a/src/controls/Private/EditMenu_ios.qml b/src/controls/Private/EditMenu_ios.qml
index 94c4617a..690b8797 100644
--- a/src/controls/Private/EditMenu_ios.qml
+++ b/src/controls/Private/EditMenu_ios.qml
@@ -44,48 +44,7 @@ Item {
property bool __showMenuFromTouch: false
property Component defaultMenu: Menu {
- MenuItem {
- text: qsTr("Cut")
- shortcut: StandardKey.Cut
- visible: !input.readOnly && selectionStart !== selectionEnd
- onTriggered: {
- cut();
- select(input.cursorPosition, input.cursorPosition);
- }
- }
- MenuItem {
- text: qsTr("Copy")
- shortcut: StandardKey.Copy
- visible: selectionStart !== selectionEnd
- onTriggered: {
- copy();
- select(input.cursorPosition, input.cursorPosition);
- }
- }
- 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();
- }
+ /* iOS plugin will automatically populate edit menus with standard edit actions */
}
Connections {