Important: Please read the Qt Code of Conduct -

Building Process of QML/C++

  • Hi,

    I would like to know how the building process of a QML/C++ application works.

    This is what I know so far:
    Qt C++ build process

    • Qt creates moc files
    • Compilation of moc files to create object files
    • Linking of Object files to create the executable


    • Interpreted at runtime by QtDeclarative

    Now my questions:
    How does this work in a QML/C++ application?
    How does the C++ part communicate with the QML Part?


  • Moderators

    Ad. 1. Nothing changes here.
    Ad. 2. Communication is done through Qt's Meta Object System, the very same that provides signals/ slots, method invocation in "standard" Qt.

  • Ad. 1. What sierdzio said.
    Ad. 2. Have a look at a QML application, and find the application viewer object. Through it's rootContext(), you get access to the environment as it is seen from QML. If you register a QObject as a context object under a name, this name will be known in QML. You get access to this QObject's declared Q_PROPERTY's, it's signals and it's slot. Almost all communication happens by connecting QML properties or signals and properties, signals or slots of the QObject.

  • Thanks. Much clearer now...

Log in to reply