Dear list,

I'd like to upgrade the releases of my application from Qt 5.15 to Qt 6.2, but 
I'm met with a loss in functionality that I'm not sure how to resolve.

My application is scriptable using QQmlEngine, and with Qt 5, the loaded JS 
files had the global Qt namespace values available as part of the "Qt" variable:

> Object.keys(Qt)

The list goes on and on, so I've truncated it. But now with Qt 6, only a 
handful of members remain, basically none of the global namespace values are 
available anymore:

> Object.keys(Qt)

I did a quick test by loading a QML file, and in that file the value of 
Qt.Checked is available:


    const f = __filename
    const c = Qt.createComponent(`${FileInfo.path(f)}/test.qml`)
    let window = c.createObject()
    tiled.log(`from JS module: ${Qt.Checked}`)


    import QtQml
    QtObject {
        Component.onCompleted: {
            tiled.log(`from QML component: ${Qt.Checked}`)

The output:

    Importing module '/home/bjorn/.config/tiled/extensions/modules.mjs'
    from QML component: 2
    from JS module: undefined

Does anybody have any idea how I can make the Qt namespace values available in 
JS files when using Qt 6? This is critical since I depend on a number of these 
values in my scripting API.

Interest mailing list

Reply via email to