Here is a complete listing of the example source file.
import QtQuick 2.11
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.1
ColumnLayout {
anchors.fill: parent
Service {
id: service
name: "Database Service"
controllers: [
ServiceAutoRepair {},
ServiceAutoActivate {}
]
Database {
connectionName: "exampleConnection"
type: "QSQLITE"
host: "localhost"
port: 5432
name: "test"
user: "bill"
password: "windows"
}
}
ColumnLayout {
Layout.alignment:
Qt.AlignHCenter |
Qt.AlignVCenter
Row {
spacing: 5
Label {
text: service.name + ":"
}
Label {
text: service.status
}
}
Row {
spacing: 5
Button {
text: qsTr("Start")
onClicked: service.start()
}
Button {
text: qsTr("Stop")
onClicked: service.stop()
}
}
}
}