I am trying to read an int value
from my QML
side on c++
but this value remains 0
and doesn't update on c++
side while console.log()
clearly shows me that it increments after each click . What am I doing wrong here?
.qml file
FocusScope {
property alias myrecordint: startbutton.recordint
Rectangle {
id: buttonPaneShadow
width: bottomColumn.width + 16
height: parent.height
anchors.top: parent.top
anchors.right: parent.right
color: "white"
Column {
anchors {
right: parent.right
top: parent.top
margins: 8
}
id: buttonsColumn
anchors.rightMargin: 20
anchors.topMargin: 20
spacing: 12
CameraButton {
id: startbutton
property int recordint:0
text: "Record"
visible: camera.videoRecorder.recorderStatus == CameraRecorder.LoadedStatus
onClicked:
{
recordint=recordint+1
camera.videoRecorder.record()
console.log(recordint)
}
}
}
}
}
.cpp file
QQmlEngine engine;
QQmlComponent component(&engine, QUrl("qrc:/VideoCaptureControls.qml"));
QObject *object = component.create();
qDebug() << "Property value:" << QQmlProperty::read(object, "myrecordint").toInt();