Qt World Summit: Register Today!

Comunication from C++ and Qml interface

  • Hi,
    I've a user interface made by QML, and now I'm starting to develop the backend engine of the application (the C++ core).
    I've see on doc guide, that there are a lot of different ways to establish comunication from these two part of the application: what is the best, and simpliest?

  • Moderators

    None is best, most are simple once you get the idea ;)

    I usually attach QObject-derivatives as global context properties to QML for stuff that I need everywhere (for example, app settings). Then I also use custom QQuickItem subclasses and register them to do some more hardcore integration with C++ (and save some memory and CPU power) in some cases.

    The least useful (in my specific use case!) is the "static" context property: I only use it to manage relative paths (I have a PWD property that holds the root dir).

Log in to reply