mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-03 11:21:52 +02:00
[ui] Selection of text for copy of text attribute fixed
If there is no text selected, then it copies all the attribute, otherwise it copies only the selected text.
This commit is contained in:
parent
e3e25e677e
commit
dd7e19dd2c
1 changed files with 10 additions and 12 deletions
|
@ -211,9 +211,9 @@ RowLayout {
|
|||
text: attribute.value
|
||||
selectByMouse: true
|
||||
onEditingFinished: setTextFieldAttribute(text)
|
||||
persistentSelection: true
|
||||
onAccepted: {
|
||||
setTextFieldAttribute(text)
|
||||
root.forceActiveFocus()
|
||||
}
|
||||
Component.onDestruction: {
|
||||
if (activeFocus)
|
||||
|
@ -232,15 +232,11 @@ RowLayout {
|
|||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.AllButtons
|
||||
onClicked: {
|
||||
if (mouse.button == Qt.RightButton) {
|
||||
var menu = menuCopy.createObject(parameterLabel)
|
||||
menu.parent = parameterLabel
|
||||
menu.popup()
|
||||
} else {
|
||||
textField.forceActiveFocus()
|
||||
}
|
||||
acceptedButtons: Qt.RightButton
|
||||
onClicked: {
|
||||
var menu = menuCopy.createObject(parameterLabel)
|
||||
menu.parent = parameterLabel
|
||||
menu.popup()
|
||||
}
|
||||
|
||||
property Component menuCopy : Menu {
|
||||
|
@ -248,8 +244,10 @@ RowLayout {
|
|||
text: "Copy"
|
||||
enabled: attribute.value != ""
|
||||
onTriggered: {
|
||||
Clipboard.clear()
|
||||
Clipboard.setText(attribute.value)
|
||||
// if no selection, select all
|
||||
if (textField.selectionStart === textField.selectionEnd)
|
||||
textField.selectAll()
|
||||
textField.copy()
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue