[Interest] QQmlPropertyMap inside a QList, signal valueChanged isn't emitted maybe?
Maxime Roussin-Bélanger
maxime.roussinbelanger at gmail.com
Wed Feb 7 23:41:13 CET 2024
Hello,
I have something like this:
`Q_PROPERTY(QList<QQmlPropertyMap*> myList ...)`
And in QML I tried to do something like this:
```
Item {
ListModel {
id: myListModel
}
StackLayout {
Repeater {
model: myListModel
GridLayout {
CheckBox {
Component.onCompleted: {
checked = model.enable;
}
onCheckStateChanged: function () {
model.enable = enableCheckbox.checked;
}
}
}
}
Component.onCompleted: function () {
for (let i = 0; i < myContextObject.myList.length; i++) {
myListModel.append(myContextObject.myList[i]);
}
}
}
```
In my C++, I have connected individually each QQmlPropertyMap to a slot
with the valueChanged signal.
Looks something like this:
```
auto* firstObject = new QQmlPropertyMap(this);
QObject::connect(firstObject,
&QQmlPropertyMap::valueChanged,
this,
[this](const QString& key, const QVariant& value)
{
this->slot(0, key, value);
});
myList.append(firstObject);
```
I was expecting my slot to be called, but it's not. What am I missing?
Thanks,
Max
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20240207/59929052/attachment.htm>
More information about the Interest
mailing list