Answer the question
In order to leave comments, you need to log in
Why does TypeError: Cannot read property '...' of undefined occur?
In general terms, I have a FlowChart element whose p1 and p2 properties need to be controlled from the SensorValuesSetter element using text fields.
The implementation of the SensorValuesSetter element is in another file.
// SensorValuesSetter.qml
ApplicationWindow {
id: valueSetterWindow
// ...
GridLayout {
// ...
Label { text: "Давление 1: "; Layout.fillWidth:true; }
ValueInputField { id: p1_val_field; }
Label { text: "Давление 2: "; Layout.fillWidth:true; }
ValueInputField { id: p2_val_field; }
// ....
Button {
id: button
text: qsTr("Применить")
onPressed: {
valueSetterWindow.parent.p1.value = Number.fromLocaleString(p1_val_field.text)
valueSetterWindow.parent.p2.value = Number.fromLocaleString(p2_val_field.text)
// ...
}
}
// main.qml
// ...
FlowChart {
id: flowChart
anchors.fill: parent
SensorValuesSetter {
id: valueSetterWindow
}
// ...
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question