make the mobile text toolbar appear only on press
This commit is contained in:
parent
bdb2783b0d
commit
9aeaf7cbb5
@ -159,6 +159,9 @@ T.ComboBox {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onTextChanged: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible = false;
|
||||||
|
onPressed: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible = true;
|
||||||
|
|
||||||
onPressAndHold: {
|
onPressAndHold: {
|
||||||
if (!Kirigami.Settings.tabletMode) {
|
if (!Kirigami.Settings.tabletMode) {
|
||||||
return;
|
return;
|
||||||
|
@ -60,6 +60,9 @@ T.TextArea {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onTextChanged: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible = false;
|
||||||
|
onPressed: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible = true;
|
||||||
|
|
||||||
onPressAndHold: {
|
onPressAndHold: {
|
||||||
if (!Kirigami.Settings.tabletMode) {
|
if (!Kirigami.Settings.tabletMode) {
|
||||||
return;
|
return;
|
||||||
|
@ -62,6 +62,9 @@ T.TextField {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onTextChanged: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible = false;
|
||||||
|
onPressed: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible = true;
|
||||||
|
|
||||||
onPressAndHold: {
|
onPressAndHold: {
|
||||||
if (!Kirigami.Settings.tabletMode) {
|
if (!Kirigami.Settings.tabletMode) {
|
||||||
return;
|
return;
|
||||||
|
@ -44,6 +44,7 @@ Item {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
width: Math.round(units.gridUnit/1.5)
|
width: Math.round(units.gridUnit/1.5)
|
||||||
height: width
|
height: width
|
||||||
|
visible: MobileTextActionsToolBar.shouldBeVisible
|
||||||
anchors {
|
anchors {
|
||||||
horizontalCenter: parent.horizontalCenter
|
horizontalCenter: parent.horizontalCenter
|
||||||
verticalCenter: parent.bottom
|
verticalCenter: parent.bottom
|
||||||
|
@ -33,6 +33,7 @@ Popup {
|
|||||||
modal: false
|
modal: false
|
||||||
focus: false
|
focus: false
|
||||||
closePolicy: Popup.NoAutoClose
|
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
|
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
|
width: contentItem.implicitWidth + leftPadding + rightPadding
|
||||||
|
|
||||||
@ -58,7 +59,7 @@ Popup {
|
|||||||
ToolButton {
|
ToolButton {
|
||||||
focusPolicy: Qt.NoFocus
|
focusPolicy: Qt.NoFocus
|
||||||
icon.name: "edit-cut"
|
icon.name: "edit-cut"
|
||||||
visible: controlRoot.selectedText.length > 0
|
visible: controlRoot.selectedText.length > 0 && (!controlRoot.hasOwnProperty("echoMode") || controlRoot.echoMode === TextInput.Normal)
|
||||||
onClicked: {
|
onClicked: {
|
||||||
controlRoot.cut();
|
controlRoot.cut();
|
||||||
}
|
}
|
||||||
@ -66,7 +67,7 @@ Popup {
|
|||||||
ToolButton {
|
ToolButton {
|
||||||
focusPolicy: Qt.NoFocus
|
focusPolicy: Qt.NoFocus
|
||||||
icon.name: "edit-copy"
|
icon.name: "edit-copy"
|
||||||
visible: controlRoot.selectedText.length > 0
|
visible: controlRoot.selectedText.length > 0 && (!controlRoot.hasOwnProperty("echoMode") || controlRoot.echoMode === TextInput.Normal)
|
||||||
onClicked: {
|
onClicked: {
|
||||||
controlRoot.copy();
|
controlRoot.copy();
|
||||||
}
|
}
|
||||||
@ -74,6 +75,7 @@ Popup {
|
|||||||
ToolButton {
|
ToolButton {
|
||||||
focusPolicy: Qt.NoFocus
|
focusPolicy: Qt.NoFocus
|
||||||
icon.name: "edit-paste"
|
icon.name: "edit-paste"
|
||||||
|
visible: controlRoot.canPaste
|
||||||
onClicked: {
|
onClicked: {
|
||||||
controlRoot.paste();
|
controlRoot.paste();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user