Unsolved Problem with a scope
-
I'm having 2 files and FuelGauge.qml and Speedometer.qml, I'm tyring to access some data from FuelGauge.qml, but for some reason I can't access it at all. I want to assing to property fuel value of fuelId.value, but it is out of a scope, so I tried other way, that is commented and it showed error:
And for use in other files I need to have it in place of first commented property
import QtQuick 2.14 import QtQuick.Extras 1.4 import QtQuick.Controls.Styles 1.4 import QtQuick.Window 2.14 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") CircularGauge{ id: gauge height: 480 width: 640 maximumValue: 100 //property int fuel: mystyle.fuel style: CircularGaugeStyle{ id: myStyle minimumValueAngle: -150 maximumValueAngle: 150 //property int fuel: backgroundRect.value background: Rectangle{ id: backgroundRect radius: 360 color: "black" //property int fuel: fuelId.value FuelGauge{ id: fuelId consumption: gauge.value } } } } }
-
Generally when I try to access something from inside background: Rectangle{}, I can't do it and I have no idea why.
-
@Traust said in Problem with a scope:
Generally when I try to access something from inside background: Rectangle{}, I can't do it and I have no idea why.
Please paste your other qml files for comparison/testing.