Changing QML property from C++ : how to change width of QML property?
QML and Qt Quick
3
Posts
3
Posters
3.3k
Views
1
Watching
-
I have a QML element connected to a C++ object with just one property: counter.
When I update the counter property from C++ I want to update the width of my QML element (it's a Rectangle).
I have tried:
@
Rectangle {
property int counter = model.counter
width: counter * 10
}
@The width does not change when I change the counter property... How come?
[edit: Highlight added / Denis Kormalev]
-
I think you've meant
@
Rectangle {
property int counter: model.counter
width: counter * 10
}
@
Do you change qml property or property of model from c++? If second, then you should use alias instead of full qml property. And don't forget about emitting signal on property change (one mentioned in NOTIFY).P.S. And please, don't forget to highlight your code