diff --git a/src/declarativeimports/plasmacomponents3/ComboBox.qml b/src/declarativeimports/plasmacomponents3/ComboBox.qml index 24e1092d7..1bae1bf61 100644 --- a/src/declarativeimports/plasmacomponents3/ComboBox.qml +++ b/src/declarativeimports/plasmacomponents3/ComboBox.qml @@ -159,6 +159,9 @@ T.ComboBox { } } + onTextChanged: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible = false; + onPressed: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible = true; + onPressAndHold: { if (!Kirigami.Settings.tabletMode) { return; diff --git a/src/declarativeimports/plasmacomponents3/TextArea.qml b/src/declarativeimports/plasmacomponents3/TextArea.qml index 36f52f5e7..7ebd1751f 100644 --- a/src/declarativeimports/plasmacomponents3/TextArea.qml +++ b/src/declarativeimports/plasmacomponents3/TextArea.qml @@ -60,6 +60,9 @@ T.TextArea { } } + onTextChanged: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible = false; + onPressed: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible = true; + onPressAndHold: { if (!Kirigami.Settings.tabletMode) { return; diff --git a/src/declarativeimports/plasmacomponents3/TextField.qml b/src/declarativeimports/plasmacomponents3/TextField.qml index d7ec6fe9d..523a25740 100644 --- a/src/declarativeimports/plasmacomponents3/TextField.qml +++ b/src/declarativeimports/plasmacomponents3/TextField.qml @@ -62,6 +62,9 @@ T.TextField { } } + onTextChanged: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible = false; + onPressed: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible = true; + onPressAndHold: { if (!Kirigami.Settings.tabletMode) { return; diff --git a/src/declarativeimports/plasmacomponents3/mobiletextselection/MobileCursor.qml b/src/declarativeimports/plasmacomponents3/mobiletextselection/MobileCursor.qml index 2d469874f..8be90b6d3 100644 --- a/src/declarativeimports/plasmacomponents3/mobiletextselection/MobileCursor.qml +++ b/src/declarativeimports/plasmacomponents3/mobiletextselection/MobileCursor.qml @@ -44,6 +44,7 @@ Item { Rectangle { width: Math.round(units.gridUnit/1.5) height: width + visible: MobileTextActionsToolBar.shouldBeVisible anchors { horizontalCenter: parent.horizontalCenter verticalCenter: parent.bottom diff --git a/src/declarativeimports/plasmacomponents3/mobiletextselection/MobileTextActionsToolBar.qml b/src/declarativeimports/plasmacomponents3/mobiletextselection/MobileTextActionsToolBar.qml index 9b14748da..fa8b1e16d 100644 --- a/src/declarativeimports/plasmacomponents3/mobiletextselection/MobileTextActionsToolBar.qml +++ b/src/declarativeimports/plasmacomponents3/mobiletextselection/MobileTextActionsToolBar.qml @@ -33,6 +33,7 @@ Popup { modal: false focus: false closePolicy: Popup.NoAutoClose + property bool shouldBeVisible: false x: controlRoot ? Math.min(Math.max(0, controlRoot.mapToItem(root.parent, controlRoot.positionToRectangle(controlRoot.selectionStart).x, 0).x - root.width/2), controlRoot.Window.contentItem.width - root.width) : 0 @@ -50,7 +51,7 @@ Popup { } - visible: controlRoot ? Kirigami.Settings.tabletMode && (controlRoot.selectedText.length > 0 || controlRoot.canPaste) : false + visible: controlRoot ? shouldBeVisible && Kirigami.Settings.tabletMode && (controlRoot.selectedText.length > 0 || controlRoot.canPaste) : false width: contentItem.implicitWidth + leftPadding + rightPadding @@ -58,7 +59,7 @@ Popup { ToolButton { focusPolicy: Qt.NoFocus icon.name: "edit-cut" - visible: controlRoot.selectedText.length > 0 + visible: controlRoot.selectedText.length > 0 && (!controlRoot.hasOwnProperty("echoMode") || controlRoot.echoMode === TextInput.Normal) onClicked: { controlRoot.cut(); } @@ -66,7 +67,7 @@ Popup { ToolButton { focusPolicy: Qt.NoFocus icon.name: "edit-copy" - visible: controlRoot.selectedText.length > 0 + visible: controlRoot.selectedText.length > 0 && (!controlRoot.hasOwnProperty("echoMode") || controlRoot.echoMode === TextInput.Normal) onClicked: { controlRoot.copy(); } @@ -74,6 +75,7 @@ Popup { ToolButton { focusPolicy: Qt.NoFocus icon.name: "edit-paste" + visible: controlRoot.canPaste onClicked: { controlRoot.paste(); }