Important: Please read the Qt Code of Conduct -


  • Hello,

    I am trying to port Qt4.8 QmlExtensionPlugin based plugin to Qt5. I am using this guide as help:

    In my plugin it used to be possible to create QDeclarativeComponent giving it the qml engine passed as a pointer in a call to initializeEngine (my plugin is derived from QDeclarativeExtensionPlugin).

    After moving to Qt5 library built by myself - deriving from QQmlExtensionPlugin and changing QDeclarativeComponent to QQmlComponent and trying the same in initializeEngine callback I get an assert in QQmlThread::internallCallMethodInThread (line 292: Q_ASSERT(d->m_mainThreadWaiting == false);).

    @void myPlugin::initializeEngine(QQmlEngine *engine, const char uri)
    QString data = "some lines of qml";
    QQmlComponent myComponent(engine);
    myComponent.setData(data.toLatin1(), engine->baseUrl()); /assert after this line/
    styleObject = myComponent.create();

    _ASSERT: "d->m_mainThreadWaiting == false" in file qml\ftw\qqmlthread.cpp, line 292
    Debug Error!

    Program: C:...\Qt5Cored.dll
    Module: 5.1.0
    File: global\qglobal.cpp
    Line: 1992

    ASSERT: "d->m_mainThreadWaiting == false" in file qml\ftw\qqmlthread.cpp, line 292_

    Any ideas what is going wrong here?

Log in to reply