Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-36226

Crash when using QList<QObjectSubclass*> property in QML

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 5.1.0 , 5.2.0
    • None
    • Mingw32, Windows XP (Doesn't crash on Linux OpenSuse x86_64 (though it doesn't work either))

    Description

      I have a little sample program that shows the problem.

      It exposes a MyClass object to Qml (rootContext->setContextProperty("myObject", myClass))

      MyClass has a property named list (declared with Q_PROPERTY) and its type is QList<LittleObject*> (with class LittleObject : public QObject

      {...}

      )

      When I try to set a Repeater model to that property (Reapeater

      {model: myObject.list}

      ), it crashes on an assert :

      ASSERT: "list.type() != QQmlListAccessor::Instance" in file util\qqmladaptormodel.cpp, line 931

      If the list property is of type QList<QObject*> and the method list returns QList<QObject*>, Qml accepts it and even gives access to the LittleObject* objects in the list (this is shown with the property list2)

      QList<LittleObject*> is of course registered as a metatype.

      I don't want to use QQmlListProperty (because I don't need it, I only use constant QList's)

      Attachments

        1. testlists.zip
          17 kB
          Detlev Casanova

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              aalpert Alan Alpert
              cazou88 Detlev Casanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes