Important: Please read the Qt Code of Conduct -

Construct QQmlListProperty from QList<MyClass>

  • Hi,
    I am just faced to problem how to pass args to constructor of QQmlListProperty. I tried this, but with no success:
    DataPacket is my custom class (subclassed from QObject) and _dataPacketList is instance.

    I know there is more simple constructor
    QQmlListProperty::QQmlListProperty(QObject * object, QList<T *> & list)
    But in docs is written:

    "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."

    Could you please help me how to pass pointers to QList methods?
    Thank you in advance.

  • search "QQmlListProperty" inside Qt examples folder, you will get answers.

Log in to reply