Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. C++ to QML Export: "Cannot assign object to list"

C++ to QML Export: "Cannot assign object to list"

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 937 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Ingo
    wrote on last edited by Ingo
    #1

    Edit: To my surprise it works as a release build but the issue is still present in any debug build I am doing. Release build works without any changes... Did anyone experience something like that?

    I am currently moving from Qt4.8,1 to Qt5.5.0 and I am facing a serious problem with the elements I am exporting from C++ to QML. It (still) uses the old way using QDeclarativeItem to export the UI elements to QML. At the moment I can't use QtQuick2 because part of the application heavily relies on QGraphicsView and worse: QGraphicsScene. So I still have to stick with the QDeclarative stuff which should still work with Qt5.5.

    I am doing everything as with Qt4.8.1 that is: creating the UI elements as QDeclarativeItems in C++ and register them in QML with qmlRegisterType< >. Everything is compiled nicely and the import statement in the QML files don't show errors. I can start the application and all pure qml elements are rendered and do what they are supposed to do.

    BUT: The elements exported from C++ can not be created. It is always states that "Cannot assign object to list" in the line in which such an element is created. I found a blog entry from Lewis Manor (http://lewismanor.blogspot.de/2015/01/qquickitem-cannot-assign-object-to-list.html) in which he describes the same error message and found that a qRegisterMetaData<QObject*>("foo") destroyed the MetaSystem. So I searched for any similar error but could not find one. I even disabled all qRegisterMetaData and qmlRegisterType stuff except the one element I want to create. Still the same issue.

    Can anyone help please??

    Out of desparation I also posted this in the [Interest] mailing list . Appologies for this double posting.

    1 Reply Last reply
    0
    • N Offline
      N Offline
      NCsoft
      wrote on last edited by
      #2

      Even your application relies on QGraphicsView and QGraphicsScene, you can still use QtQuick2. Try to use QQuickWidget instead of QDeclarativeView.

      I 1 Reply Last reply
      0
      • N NCsoft

        Even your application relies on QGraphicsView and QGraphicsScene, you can still use QtQuick2. Try to use QQuickWidget instead of QDeclarativeView.

        I Offline
        I Offline
        Ingo
        wrote on last edited by Ingo
        #3

        @NCsoft
        Thank you for this hint, I will try that as well. I am still struggeling with the error I initially reported. I did a minimal example which is a main function which only creates a QQuickView(1)or a QDeclarativeView(2) and loads a minimal main.qml file with only a text element and a QQuickPaintedItem(1) or a QDeclarativeItem(2). QQuickPaintedItem(1) or QDeclarativeItem(2) are exportet inside a QQmlExtensionPlugin(1) or a QDeclarativExtensionPlugin(2)

        Both versions do not work.
        (1) Fails to load QtQuick, module is not known and does not load the exported QQuickPaintedItem
        (2) Fails to load exported QDeclarativeItem but can load pure qml types such as Text{}

        Meanwhile I assume that something with my installation is wrong, but I can't figure out what. All loaded dlls are correct and I removed all old installations of Qt and QtCreator and removed everything from the PATH which could load a Qt dll.

        I am using Qt 5.5.0 and QtCreator 3.6.1, building with Visual Studio 2013 on Windows 7

        Running out of ideas...

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved