Skip to content

RFC - experience from user migrating from QtScript (Qt5) to pythonqt (Qt6) #226

Description

@JulienMaille

Hello and thanks a lot for this incredible work.
I have a question rather than an issue: I'm desperately looking for a solution to migrate from Qt5 to Qt6 without losing the scriptability of my application. I rely a lot on qtscriptgenerator classes and was using tricks like exposing the a top widget of my app to QtScript and then the "auto-discoverability" of all its widgets (and theit slots/properties), which would allow the scripter to insert his own script-defined widgets, hide or move existing ones, etc.
Is this something that I could to with pythonqt?
Thanks in advance.

PS: until now I had found https://github.com/qcad/qtjsapi and PySide/Shiboken, how is pythonqt different from the latter (except the setup seems to be much simpler)

Activity

  1. iltommi commented on Jul 2, 2024

    @iltommi

    QJSEngine is still there in qt6 (in Qml qt6 module) if you want to stick to ecma javascript

    #include <QJSEngine>
    [...]
    QJSEngine = my_eng;
    my_eng.globalObject().setProperty("myobj", my_eng.newQObject(myobj));
    QJSValue retval = my_eng.evaluate("myobj.dosomething()");
    
  2. JulienMaille commented on Jul 2, 2024

    @JulienMaille
    ContributorAuthor

    QJSEngine is still there in qt6 (in Qml qt6 module) if you want to stick to ecma javascript

    Sure but you can't benefit from QtScriptGenerator, can you?

  3. usiems commented on Jul 3, 2024

    @usiems
    Contributor

    Yes, you can do the things you requested with PythonQt: The Qt API is wrapped for the most part, and you can derive from existing Qt classes in Python.

    I don't really know PySide/Shiboken, so I couldn't tell you all the actual differences. One thing that I know of, which makes PythonQt slightly incompatible with PySide, is that Qt proprties take precedence over methods with the same name in PythonQt. Also super() doesn't work for Qt classes in PythonQt, you have to use the class name of the super class.

  4. locked and limited conversation to collaborators on Sep 19, 2025
  5. converted this issue into a discussion #305 on Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions