The docstring for this constructor [qt-project.org] claims:
Generally this constructor should not be used in production code, as a writable QList violates QML’s memory management rules. However, this constructor can very useful while prototyping.
However, Exposing Attributes of C++ Types to QML [qt-project.org] seems to recommend its use:
QQmlListProperty is a template class that can be conveniently constructed from a QList value.
…
The MessageBoard::messages() function simply creates and returns a QQmlListProperty from its QList<T> m_messages member, passing the appropriate list modification functions as required by the QQmlListProperty constructor:
Is the constructor docstring out-of-date? Or is the tutorial misleading? How is a writable QList in violation of QML’s memory management rules?
thanks,
-Mark
↧