[Interest] QQmlListProperty
Nuno Santos
nunosantos at imaginando.pt
Tue Oct 21 13:46:34 CEST 2014
Hi,
With QQmlListProperty I can expose a QList to QML. I’m doing it a lot. But, is it possible to do the opposite?
QQmlListProperty documentation is a little bit vague in this sense.
I want to receive in another QML the same list and then get the QList inside this element C++ class.
This is because the glue between this classes is made thru the UI which is all made in QML.
I’m declaring:
Q_PROPERTY(QQmlListProperty<LKClipNote> notes READ notes WRITE setNotes NOTIFY notesChanged)
QQmlListProperty<LKClipNote> notes();
void setNotes(const QQmlListProperty<LKClipNote> notes);
But I don’t really need a property read
And i’m writing:
QQmlListProperty<LKClipNote> LKClipComposer::notes()
{
qDebug() << "read";
}
void LKClipComposer::setNotes(const QQmlListProperty<LKClipNote> notes)
{
qDebug() << "write";
}
However i’m having a crash.
I also don’t know how to fetch the original list from the parameter. I know that QQmlListProperty has a data pointer but I don’t know how to get it from there.
Any tips?
Thanks,
Regards,
Nuno
More information about the Interest
mailing list