Changeset View
Changeset View
Standalone View
Standalone View
src/declarativeimports/plasmacomponents3/TextArea.qml
Show All 18 Lines | |||||
19 | 19 | | |||
20 | import QtQuick 2.6 | 20 | import QtQuick 2.6 | ||
21 | import QtQuick.Window 2.2 | 21 | import QtQuick.Window 2.2 | ||
22 | import QtQuick.Controls @QQC2_VERSION@ | 22 | import QtQuick.Controls @QQC2_VERSION@ | ||
23 | import QtQuick.Templates @QQC2_VERSION@ as T | 23 | import QtQuick.Templates @QQC2_VERSION@ as T | ||
24 | import org.kde.plasma.core 2.0 as PlasmaCore | 24 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
25 | import "private" as Private | 25 | import "private" as Private | ||
26 | import org.kde.kirigami 2.5 as Kirigami | 26 | import org.kde.kirigami 2.5 as Kirigami | ||
27 | import "mobiletextselection" as MobileTextSelection | ||||
27 | 28 | | |||
28 | T.TextArea { | 29 | T.TextArea { | ||
29 | id: control | 30 | id: control | ||
30 | 31 | | |||
31 | implicitWidth: Math.max(contentWidth + leftPadding + rightPadding, | 32 | implicitWidth: Math.max(contentWidth + leftPadding + rightPadding, | ||
32 | background ? background.implicitWidth : 0, | 33 | background ? background.implicitWidth : 0, | ||
33 | placeholder.implicitWidth + leftPadding + rightPadding) | 34 | placeholder.implicitWidth + leftPadding + rightPadding) | ||
34 | implicitHeight: Math.max(contentHeight + topPadding + bottomPadding, | 35 | implicitHeight: Math.max(contentHeight + topPadding + bottomPadding, | ||
Show All 28 Lines | 63 | onPressAndHold: { | |||
63 | if (!Kirigami.Settings.tabletMode) { | 64 | if (!Kirigami.Settings.tabletMode) { | ||
64 | return; | 65 | return; | ||
65 | } | 66 | } | ||
66 | forceActiveFocus(); | 67 | forceActiveFocus(); | ||
67 | cursorPosition = positionAt(event.x, event.y); | 68 | cursorPosition = positionAt(event.x, event.y); | ||
68 | selectWord(); | 69 | selectWord(); | ||
69 | } | 70 | } | ||
70 | 71 | | |||
71 | Private.MobileCursor { | 72 | MobileTextSelection.MobileCursor { | ||
72 | target: control | 73 | target: control | ||
73 | selectionStartHandle: true | 74 | selectionStartHandle: true | ||
74 | property var rect: target.positionToRectangle(target.selectionStart) | 75 | property var rect: target.positionToRectangle(target.selectionStart) | ||
75 | x: rect.x | 76 | x: rect.x | ||
76 | y: rect.y | 77 | y: rect.y | ||
77 | } | 78 | } | ||
78 | 79 | | |||
79 | onFocusChanged: { | 80 | onFocusChanged: { | ||
80 | if (focus) { | 81 | if (focus) { | ||
81 | Private.MobileTextActionsToolBar.controlRoot = control; | 82 | MobileTextSelection.MobileTextActionsToolBar.controlRoot = control; | ||
82 | } | 83 | } | ||
83 | } | 84 | } | ||
84 | 85 | | |||
85 | Label { | 86 | Label { | ||
86 | id: placeholder | 87 | id: placeholder | ||
87 | x: control.leftPadding | 88 | x: control.leftPadding | ||
88 | y: control.topPadding | 89 | y: control.topPadding | ||
89 | width: control.width - (control.leftPadding + control.rightPadding) | 90 | width: control.width - (control.leftPadding + control.rightPadding) | ||
Show All 24 Lines |