diff --git a/src/framework/uicomponents/qml/Muse/UiComponents/ValueList.qml b/src/framework/uicomponents/qml/Muse/UiComponents/ValueList.qml index 7bba451d8276e..7b18a2c0d695a 100644 --- a/src/framework/uicomponents/qml/Muse/UiComponents/ValueList.qml +++ b/src/framework/uicomponents/qml/Muse/UiComponents/ValueList.qml @@ -277,7 +277,7 @@ Item { isSelected: selectionModel.hasSelection && selectionModel.isSelected(modelIndex) readOnly: root.readOnly - keyReadOnly: root.isReadOnlyFunction(model.index) + keyReadOnly: root.isKeyEditable ? root.isReadOnlyFunction(model.index) : true drawZebra: root.drawZebra keyColumnWidth: root.keyColumnWidth diff --git a/src/framework/uicomponents/qml/Muse/UiComponents/internal/ValueListItem.qml b/src/framework/uicomponents/qml/Muse/UiComponents/internal/ValueListItem.qml index b5bbc907b669f..ea6c749428bdc 100644 --- a/src/framework/uicomponents/qml/Muse/UiComponents/internal/ValueListItem.qml +++ b/src/framework/uicomponents/qml/Muse/UiComponents/internal/ValueListItem.qml @@ -145,7 +145,8 @@ ListItemBlank { } Connections { - target: keyLoader.item + target: (root.keysEditable && !root.keyReadOnly) ? keyLoader.item : null + ignoreUnknownSignals: true function onChanged(newVal) { root.item[keyRoleName] = newVal listItem.keyEdited(newVal) @@ -204,10 +205,6 @@ ListItemBlank { valueLoader.item.maxValue = root.item[maxValueRoleName] } } - - valueLoader.item.navPanel = valueLoader.navPanel - valueLoader.item.navRow = valueLoader.navRow - valueLoader.item.navColumn = valueLoader.navColumn } onValChanged: { @@ -251,10 +248,6 @@ ListItemBlank { onLoaded: { textLoader.item.val = textLoader.val ?? "" - - textLoader.item.navPanel = textLoader.navPanel - textLoader.item.navRow = textLoader.navRow - textLoader.item.navColumn = textLoader.navColumn } onValChanged: { @@ -275,168 +268,168 @@ ListItemBlank { target: textLoader.item function onChanged(newVal) { textLoader.changed(newVal) } } - } - } - Component { - id: singleClickTextComp + Component { + id: singleClickTextComp - TextInputField { - id: textControl + TextInputField { + id: textControl - property string val - signal changed(string newVal) + property string val + signal changed(string newVal) - property string accessibleName: navigation.accessible.name - property NavigationPanel navPanel: null - property int navRow: 0 - property int navColumn: 0 + property string accessibleName: navigation.accessible.name + property NavigationPanel navPanel: textLoader.navPanel + property int navRow: textLoader.navRow + property int navColumn: 0 - navigation.panel: navPanel - navigation.row: navRow - navigation.column: navColumn + navigation.panel: navPanel + navigation.row: navRow + navigation.column: navColumn - currentText: val + currentText: val - textSidePadding: root.textInputSidePadding + textSidePadding: root.textInputSidePadding - onTextEdited: function(newTextValue) { - changed(newTextValue) + onTextEdited: function(newTextValue) { + changed(newTextValue) + } + } } - } - } - Component { - id: doubleClickTextComp - - Item { - id: doubleClickItem + Component { + id: doubleClickTextComp - height: root.height - width: 10 + Item { + id: doubleClickItem - property string val - property string accessibleName: navigation.accessible.name - property NavigationPanel navPanel - property int navRow - property int navColumn + height: root.height + width: 10 - signal changed(string newVal) - signal startEdit(var val) - signal escaped() + property string val + property string accessibleName: navigation.accessible.name + property NavigationPanel navPanel: textLoader.navPanel + property int navRow: textLoader.navRow + property int navColumn - onStartEdit: function(val) { - valueEditLoader.edit(val) - } + signal changed(string newVal) + signal startEdit(var val) + signal escaped() - onEscaped: { - valueEditLoader.escaped() - } + onStartEdit: function(val) { + valueEditLoader.edit(val) + } - NavigationFocusBorder { - navigationCtrl: NavigationControl { - id: valueNavCtrl - enabled: doubleClickItem.enabled && doubleClickItem.visible - panel: doubleClickItem.navPanel - row: doubleClickItem.navRow - column: doubleClickItem.navColumn - - onTriggered: { - valueEditLoader.edit(doubleClickItem.val) - root.clicked(mouseArea) + onEscaped: { + valueEditLoader.escaped() } - onActiveChanged: { - if (!active) { - valueEditLoader.escaped() + NavigationFocusBorder { + navigationCtrl: NavigationControl { + id: valueNavCtrl + enabled: doubleClickItem.enabled && doubleClickItem.visible + panel: doubleClickItem.navPanel + row: doubleClickItem.navRow + column: doubleClickItem.navColumn + + onTriggered: { + valueEditLoader.edit(doubleClickItem.val) + root.clicked(mouseArea) + } + + onActiveChanged: { + if (!active) { + valueEditLoader.escaped() + } + } } - } - } - anchors.topMargin: 1 - anchors.bottomMargin: 1 - } + anchors.topMargin: 1 + anchors.bottomMargin: 1 + } - StyledTextLabel { - id: valueLabel + StyledTextLabel { + id: valueLabel - anchors.fill: parent - horizontalAlignment: Text.AlignLeft + anchors.fill: parent + horizontalAlignment: Text.AlignLeft - visible: !valueEditLoader.isEditState + visible: !valueEditLoader.isEditState - text: doubleClickItem.val - } + text: doubleClickItem.val + } - MouseArea { - anchors.fill: valueLabel + MouseArea { + anchors.fill: valueLabel - acceptedButtons: Qt.LeftButton - hoverEnabled: true - propagateComposedEvents: true + acceptedButtons: Qt.LeftButton + hoverEnabled: true + propagateComposedEvents: true - onDoubleClicked: (mouse) => { - mouse.accepted = true - valueEditLoader.edit(doubleClickItem.val) - } - } + onDoubleClicked: (mouse) => { + mouse.accepted = true + valueEditLoader.edit(doubleClickItem.val) + } + } - Loader { - id: valueEditLoader + Loader { + id: valueEditLoader - anchors.fill: valueLabel + anchors.fill: valueLabel - property bool isEditState: false - sourceComponent: valueEditLoader.isEditState ? valueEditComp : null + property bool isEditState: false + sourceComponent: valueEditLoader.isEditState ? valueEditComp : null - function edit(text) { - valueEditLoader.isEditState = true - valueEditLoader.item.currentText = text - valueEditLoader.item.newValue = text - valueEditLoader.item.visible = true - valueEditLoader.item.ensureActiveFocus() - } + function edit(text) { + valueEditLoader.isEditState = true + valueEditLoader.item.currentText = text + valueEditLoader.item.newValue = text + valueEditLoader.item.visible = true + valueEditLoader.item.ensureActiveFocus() + } - function escaped() { - valueEditLoader.item.escaped() - } - } + function escaped() { + valueEditLoader.item.escaped() + } + } - Component { - id: valueEditComp + Component { + id: valueEditComp - TextInputField { - id: valueEdit + TextInputField { + id: valueEdit - anchors.fill: parent + anchors.fill: parent - property string newValue: "" + property string newValue: "" - background.color: "transparent" - background.border.width: 0 - inputField.color: valueLabel.color - textSidePadding: 0 - visible: false + background.color: "transparent" + background.border.width: 0 + inputField.color: valueLabel.color + textSidePadding: 0 + visible: false - onTextChanged: function (text) { - valueEdit.newValue = text - } + onTextChanged: function (text) { + valueEdit.newValue = text + } - onAccepted: { - doubleClickItem.changed(valueEdit.newValue) - valueEditLoader.isEditState = false - } + onAccepted: { + doubleClickItem.changed(valueEdit.newValue) + valueEditLoader.isEditState = false + } - onEscaped: { - valueEditLoader.isEditState = false - } + onEscaped: { + valueEditLoader.isEditState = false + } - onFocusChanged: { - if (!valueEdit.focus) { - valueEdit.visible = false - valueEditLoader.isEditState = false - valueEdit.accepted() - doubleClickItem.changed(valueEdit.newValue) + onFocusChanged: { + if (!valueEdit.focus) { + valueEdit.visible = false + valueEditLoader.isEditState = false + valueEdit.accepted() + doubleClickItem.changed(valueEdit.newValue) + } + } } } }