This repository has been archived on 2026-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
powersync-app/mea/ui/magic/SelectStateDescriptorParamsPage.qml
2018-05-28 10:33:19 +02:00

44 lines
1.3 KiB
QML

import QtQuick 2.8
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.2
import "../components"
import "../delegates"
import Mea 1.0
Page {
id: root
// Needs to be set and filled in with deviceId and eventTypeId
property var stateDescriptor: null
readonly property var device: stateDescriptor && stateDescriptor.deviceId ? Engine.deviceManager.devices.getDevice(stateDescriptor.deviceId) : null
readonly property var stateType: device ? Engine.deviceManager.deviceClasses.getDeviceClass(device.deviceClassId).stateTypes.getStateType(stateDescriptor.stateTypeId) : null
signal backPressed();
signal completed();
header: GuhHeader {
text: qsTr("params")
onBackPressed: root.backPressed();
}
ColumnLayout {
anchors.fill: parent
ParamDescriptorDelegate {
id: paramDelegate
Layout.fillWidth: true
paramType: root.stateType
value: paramType.defaultValue
}
Button {
text: qsTr("OK")
Layout.fillWidth: true
Layout.margins: app.margins
onClicked: {
root.stateDescriptor.valueOperator = paramDelegate.operatorType
root.stateDescriptor.value = paramDelegate.value
root.completed()
}
}
}
}