Notes.qml Example File
uiforms/qml/Notes.qml
import QtQuick 2.2
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.2
import io.qt.example 1.0
NotesForm {
id: form
function readData() {
CustomerModel.selection.forEach(function (rowIndex) {
form.textArea.text = CustomerModel.get(rowIndex).notes
})
save.enabled = true
cancel.enabled = true
form.textArea.enabled = true
}
function writeData() {
CustomerModel.selection.forEach(function (rowIndex) {
var data = CustomerModel.get(rowIndex)
data.notes = form.textArea.text
CustomerModel.set(rowIndex, data)
})
}
cancel.onClicked: readData()
save.onClicked: writeData()
Connections {
target: CustomerModel.selection
onSelectionChanged: form.readData()
}
Component.onCompleted: readData()
}