summaryrefslogtreecommitdiff
path: root/src/controls/Private
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@theqtcompany.com>2016-04-12 13:54:01 +0200
committerRichard Moe Gustavsen <richard.gustavsen@theqtcompany.com>2016-04-26 10:12:57 +0000
commite7de8865926e3d51561bb44efc1f8423238058ea (patch)
treefde93107825f04491b4917ebe4a05091dfa0d65a /src/controls/Private
parent3411c3579fb9e767c819c0c8d9f35c52c9964b06 (diff)
downloadqtquickcontrols-e7de8865926e3d51561bb44efc1f8423238058ea.tar.gz
iOS: Remove text selection handling
Text selection and overlay are now done from the iOS platform plugin. Change-Id: I3903ab05816775f75708e915780f549e62797135 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/controls/Private')
-rw-r--r--src/controls/Private/EditMenu.qml2
-rw-r--r--src/controls/Private/EditMenu_ios.qml134
-rw-r--r--src/controls/Private/private.pri1
-rw-r--r--src/controls/Private/qmldir1
4 files changed, 1 insertions, 137 deletions
diff --git a/src/controls/Private/EditMenu.qml b/src/controls/Private/EditMenu.qml
index e32293d8..843ccb00 100644
--- a/src/controls/Private/EditMenu.qml
+++ b/src/controls/Private/EditMenu.qml
@@ -79,7 +79,7 @@ Loader {
sourceComponent = style.__editMenu;
else {
// todo: get ios/android/base menus from style as well
- source = (Qt.resolvedUrl(Qt.platform.os === "ios" ? "EditMenu_ios.qml"
+ source = (Qt.resolvedUrl(Qt.platform.os === "ios" ? ""
: Qt.platform.os === "android" ? "" : "EditMenu_base.qml"));
}
}
diff --git a/src/controls/Private/EditMenu_ios.qml b/src/controls/Private/EditMenu_ios.qml
deleted file mode 100644
index bf347640..00000000
--- a/src/controls/Private/EditMenu_ios.qml
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Quick Controls module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.2
-import QtQuick.Controls 1.2
-import QtQuick.Controls.Styles 1.1
-import QtQuick.Controls.Private 1.0
-
-Item {
- anchors.fill: parent
- property bool __showMenuFromTouch: false
-
- property Component defaultMenu: Menu {
- /* iOS plugin will automatically populate edit menus with standard edit actions */
- }
-
- Connections {
- target: mouseArea
-
- onClicked: {
- var pos = input.positionAt(mouse.x, mouse.y);
- var posMoved = (pos !== input.cursorPosition);
- var popupVisible = (control.menu && getMenuInstance().__popupVisible);
-
- if (!input.activeFocus)
- input.activate();
- else if (!popupVisible && !posMoved)
- __showMenuFromTouch = true;
-
- input.moveHandles(pos, pos)
- menuTimer.start();
- }
-
- onPressAndHold: {
- __showMenuFromTouch = true;
- menuTimer.start();
- }
-
- }
-
- Connections {
- target: cursorHandle ? cursorHandle : null
- ignoreUnknownSignals: true
- onPressedChanged: menuTimer.start()
- }
-
- Connections {
- target: selectionHandle ? selectionHandle : null
- ignoreUnknownSignals: true
- onPressedChanged: menuTimer.start()
- }
-
- Connections {
- target: flickable
- ignoreUnknownSignals: true
- onMovingChanged: menuTimer.start()
- }
-
- Connections {
- id: selectionConnections
- target: input
- ignoreUnknownSignals: true
- onSelectionStartChanged: menuTimer.start()
- onSelectionEndChanged: menuTimer.start()
- onActiveFocusChanged: menuTimer.start()
- }
-
- Timer {
- // We use a timer so that we end up with one update when multiple connections fire at the same time.
- // Basically we wan't the menu to be open if the user does a press and hold, or if we have a selection.
- // The exceptions are if the user is moving selection handles or otherwise touching the screen (e.g flicking).
- // What is currently missing are showing a magnifyer to place the cursor, and to reshow the edit menu when
- // flicking stops.
- id: menuTimer
- interval: 1
- onTriggered: {
- if (!control.menu)
- return;
-
- if ((__showMenuFromTouch || selectionStart !== selectionEnd)
- && control.activeFocus
- && (!cursorHandle.pressed && !selectionHandle.pressed)
- && (!flickable || !flickable.moving)
- && (cursorHandle.delegate)) {
- var p1 = input.positionToRectangle(input.selectionStart);
- var p2 = input.positionToRectangle(input.selectionEnd);
- var topLeft = input.mapToItem(null, p1.x, p1.y);
- var size = Qt.size(p2.x - p1.x + p1.width, p2.y - p1.y + p1.height)
- var targetRect = Qt.rect(topLeft.x, topLeft.y, size.width, size.height);
- getMenuInstance().__dismissMenu();
- getMenuInstance().__popup(targetRect, -1, MenuPrivate.EditMenu);
- __showMenuFromTouch = false;
- } else {
- getMenuInstance().__dismissMenu();
- }
- }
- }
-}
diff --git a/src/controls/Private/private.pri b/src/controls/Private/private.pri
index 24d1fc53..74913fb8 100644
--- a/src/controls/Private/private.pri
+++ b/src/controls/Private/private.pri
@@ -63,7 +63,6 @@ PRIVATE_QML_FILES += \
$$PWD/TextInputWithHandles.qml \
$$PWD/EditMenu.qml \
$$PWD/EditMenu_base.qml \
- $$PWD/EditMenu_ios.qml \
$$PWD/ToolMenuButton.qml \
$$PWD/BasicTableView.qml \
$$PWD/TableViewItemDelegateLoader.qml \
diff --git a/src/controls/Private/qmldir b/src/controls/Private/qmldir
index 34e3c0f0..9fe84203 100644
--- a/src/controls/Private/qmldir
+++ b/src/controls/Private/qmldir
@@ -31,7 +31,6 @@ TextHandle 1.0 TextHandle.qml
TextInputWithHandles 1.0 TextInputWithHandles.qml
EditMenu 1.0 EditMenu.qml
EditMenu_base 1.0 EditMenu_base.qml
-EditMenu_ios 1.0 EditMenu_ios.qml
ToolMenuButton 1.0 ToolMenuButton.qml
BasicTableView 1.0 BasicTableView.qml
TableViewItemDelegateLoader 1.0 TableViewItemDelegateLoader.qml