diff --git a/src/modules/value-editor/valueviewmodel.cpp b/src/modules/value-editor/valueviewmodel.cpp index 7496b87dd..0b89cbb53 100644 --- a/src/modules/value-editor/valueviewmodel.cpp +++ b/src/modules/value-editor/valueviewmodel.cpp @@ -245,6 +245,7 @@ void ValueEditor::ValueViewModel::updateRow(int rowIndex, const QVariantMap& row return; } emit dataChanged(index(rowIndex, 0), index(rowIndex, m_model->getColumnNames().size() - 1)); + emit valueUpdated(); }); } diff --git a/src/modules/value-editor/valueviewmodel.h b/src/modules/value-editor/valueviewmodel.h index 11f971804..43144b6a7 100644 --- a/src/modules/value-editor/valueviewmodel.h +++ b/src/modules/value-editor/valueviewmodel.h @@ -75,6 +75,7 @@ class ValueViewModel : public BaseListModel { void singlePageModeChanged(); void modelLoaded(); void tabClosed(); + void valueUpdated(); private: QSharedPointer m_model; diff --git a/src/qml/value-editor/editors/MultilineEditor.qml b/src/qml/value-editor/editors/MultilineEditor.qml index 8d0148f94..63aed1887 100644 --- a/src/qml/value-editor/editors/MultilineEditor.qml +++ b/src/qml/value-editor/editors/MultilineEditor.qml @@ -305,7 +305,6 @@ Item } } - ColumnLayout { anchors.fill: parent @@ -437,8 +436,6 @@ Item function saveChanges() { if (!valueEditor.item || !valueEditor.item.isEdited()) { - savingConfirmation.text = qsTranslate("RDM","Nothing to save") - savingConfirmation.open() return } @@ -447,20 +444,45 @@ Item return; var value = valueEditor.item.getValue() + saveBtnTimer.start() keyTab.keyModel.updateRow(valueEditor.currentRow, value) + }) + } + + states: [ + State { + name: "saving" + + PropertyChanges { + target: saveBtn + iconSource: "qrc:/images/wait.svg" + enabled: false + } + } + ] + + Connections { + target: keyTab.keyModel + onValueUpdated: { root.isEdited = false + saveBtnTimer.resetSaveBtn() + } - savingConfirmation.text = qsTranslate("RDM","Value was updated!") - savingConfirmation.open() - }) + onError: saveBtnTimer.resetSaveBtn() } - OkDialog { - id: savingConfirmation - title: qsTranslate("RDM","Save value") - text: "" - visible: false + Timer { + id: saveBtnTimer + interval: 500 + repeat: true + triggeredOnStart: true + onTriggered: saveBtn.state = "saving" + + function resetSaveBtn() { + saveBtnTimer.stop() + saveBtn.state = "" + } } } @@ -518,7 +540,7 @@ Item textFormat: textView.textFormat readOnly: textView.readOnly - Keys.onReleased: { + onTextChanged: { root.isEdited = true textView.model && textView.model.setTextChunk(index, textAreaPart.text) }