Important: Please read the Qt Code of Conduct -

QQmlApplicationEngine.loadData freezing on a source that QQmlApplicationEngine.load runs ok

  • I'm having a baffling issue with QQmlApplicationEngine.loadData, in which it freezes on the following code:

    # loads and translates the QML source
    qmlPath = applicationPath.with_suffix('.qml')
    qmlSource = qmlOpenSource(qmlPath)
    qmlSource = qmlTranslateAllMenus(qmlSource, applicationPath, platform=PLATFORM_MENUS)
    with open('debug_source.qml', 'wt', encoding='utf-8') as debugSorce:
        print(qmlSource, file=debugSorce)
    # loads the QML engine
    qmlSource = qmlSource.encode()
    qmlPathStr = str(qmlPath)
    engine.loadData(qmlSource, url=qmlPathStr)
    # engine.load('debug_source.qml')

    If I comment the loadData (next-to-last line) and uncomment the last line, the code runs perfectly! Any idea on what might be happening?

    P.S.: I should have mentioned that I ran some toy tests with the above code that went totally okay, but when I try it on a larger source it freezes.

Log in to reply