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. Qt 5.2 property assert failure with interfaces

Qt 5.2 property assert failure with interfaces

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.1k 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.
  • B Offline
    B Offline
    Babalas
    wrote on last edited by
    #1

    I have Qt 5.1.1 and Qt 5.2 on my machine and 5.2 is causing an assert failure in QQmlMetaObject::canConvert whereas 5.1.1 works fine. I've tracked it down to an instance where I'm assigning a derived class to a property that takes the interface class. I do have a work around which is to pass in QObject and use qobject_cast.

    Onto the code. Qml is straightforward:
    @FreeCameraControl {
    ...
    renderer: parent.renderer // renderer takes type Gui::Renderer (interface) and the instance is Viewer::ViewRender (derives from Gui::Renderer)
    }@

    Property causing the issue is in FreeCameraControl:
    @namespace Gui {
    FreeCameraControl {
    Q_PROPERTY(Renderer *renderer READ renderer WRITE setRenderer) // Not sure if this should be Gui::Renderer or just Renderer as it is now. Renderer works in 5.1.1 though
    }}@

    Class Gui::Renderer did have Q_DECLARE_INTERFACE(Gui::Renderer, "net.shadowpsi.engine.Renderer") and
    Viewer::ViewRender had Q_INTERFACES(Gui::Renderer) but I've since discovered it makes no difference if I remove these in 5.1.1.

    In QQmlPropertyPrivate::write the code goes into the property.isQObject branch. In here it calls this line
    QQmlMetaObject propMo = rawMetaObjectForType(enginePriv, propertyType);
    and propMo.isNull() ends up being true causing the assert to fail.

    Just for reference I do have another section where I'm using derived classes from a non abstract class and this works fine which is why I'm leaning towards the problem being the interface or interface with namespace.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dasun
      wrote on last edited by
      #2

      I guess it's a bug. Please report in https://bugreports.qt-project.org/

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Babalas
        wrote on last edited by
        #3

        Ok "QTBUG-33950":https://bugreports.qt-project.org/browse/QTBUG-33950

        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