Ambient Temperature Sensor
Unsolved
QML and Qt Quick
-
Hello everyone!
I am trying to work with the AmbientTemperatureSensor in Qt Qml for Android.
I have just ran the Qt example called accelbuble(https://doc.qt.io/qt-5/qtsensors-accelbubble-example.html). And just added nexn code to the qml part:
Rectangle {
x:0
y:0
width:200
height:200
TextField {
id: txt
anchors.fill: parent
text: (temp.reading ? temp.reading.temperature : "unknown")
}
}AmbientTemperatureSensor { dataRate: 100 active: true id: temp onReadingChanged: { var t = (temp.reading ? temp.reading.temperature : "unknown"); txt.text = t; console.log("Temp: ",t); } }
But the program always write "unknown", even if i run it on real mobile phone.
I am new to QML, so thanks for your answers! -