summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2014-11-10 16:40:02 +0100
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2014-11-11 11:04:38 +0100
commit313ae1c3b581a3e3a44f86793e158ba9e8eae9ab (patch)
tree62e27983274104364f7438b459f58e2f19e6eaad
parent86dacdcbbdcfc503715fb077a4b32ec2d62b5227 (diff)
downloadqtquickcontrols-313ae1c3b581a3e3a44f86793e158ba9e8eae9ab.tar.gz
Fix text selection on desktop
So far, text selection handles were only provided by mobile specific styles. The new Flat style is an exception that provides text selection handles for mobile, but is still intended to be usable on desktop too. The text selection handling code thus needs not only to check whether the text selection handles exist, but also whether it's a mobile platform. This fixes text selection on desktop. Change-Id: Ibda2045ca42970e7db692d2e8370ac0dba21625a Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
-rw-r--r--src/controls/Private/TextInputWithHandles.qml6
-rw-r--r--src/controls/TextArea.qml6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/controls/Private/TextInputWithHandles.qml b/src/controls/Private/TextInputWithHandles.qml
index ceb63084..d19dda31 100644
--- a/src/controls/Private/TextInputWithHandles.qml
+++ b/src/controls/Private/TextInputWithHandles.qml
@@ -54,7 +54,7 @@ TextInput {
property alias editMenu: editMenu
cursorDelegate: __style && __style.__cursorDelegate ? __style.__cursorDelegate : null
- selectByMouse: control.selectByMouse && (!cursorHandle.delegate || !selectionHandle.delegate)
+ selectByMouse: control.selectByMouse && (!Settings.isMobile || !cursorHandle.delegate || !selectionHandle.delegate)
// force re-evaluation when selection moves:
// - cursorRectangle changes => content scrolled
@@ -137,7 +137,7 @@ TextInput {
editor: input
parent: control
control: input.control
- active: control.selectByMouse
+ active: control.selectByMouse && Settings.isMobile
maximum: cursorHandle.position - 1
property var mappedPos: parent.mapFromItem(editor, editor.selectionRectangle.x, editor.selectionRectangle.y)
@@ -163,7 +163,7 @@ TextInput {
editor: input
parent: control
control: input.control
- active: control.selectByMouse
+ active: control.selectByMouse && Settings.isMobile
minimum: input.hasSelection ? selectionHandle.position + 1 : -1
property var mappedPos: parent.mapFromItem(editor, editor.cursorRectangle.x, editor.cursorRectangle.y)
diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml
index 8cfb6dfd..b8ed0ba2 100644
--- a/src/controls/TextArea.qml
+++ b/src/controls/TextArea.qml
@@ -770,7 +770,7 @@ ScrollView {
wrapMode: TextEdit.WordWrap
textMargin: __style && __style.textMargin !== undefined ? __style.textMargin : 4
- selectByMouse: area.selectByMouse && (!cursorHandle.delegate || !selectionHandle.delegate)
+ selectByMouse: area.selectByMouse && (!Settings.isMobile || !cursorHandle.delegate || !selectionHandle.delegate)
readOnly: false
Keys.forwardTo: area
@@ -885,7 +885,7 @@ ScrollView {
control: area
z: 1 // above scrollbars
parent: Qt.platform.os === "ios" ? editor : __scroller // no clip
- active: area.selectByMouse
+ active: area.selectByMouse && Settings.isMobile
delegate: __style.__selectionHandle
maximum: cursorHandle.position - 1
@@ -921,7 +921,7 @@ ScrollView {
control: area
z: 1 // above scrollbars
parent: Qt.platform.os === "ios" ? editor : __scroller // no clip
- active: area.selectByMouse
+ active: area.selectByMouse && Settings.isMobile
delegate: __style.__cursorHandle
minimum: edit.hasSelection ? selectionHandle.position + 1 : -1