Nominate our 2022 Qt Champions!

Rebuild QML files when running

  • Hi everybody,

    I'm working in a little Qt Quick example, and I have two qml files:

    main.qml - Where I have a Windows element and a component defined in an external file (MyComponent.qml)

    MyComponent.qml - Where I define my component (it's just a Rectangle with a Text and another Rectangle inside)

    Both of them are added into qml.qrc file in "/" path (the qml.qrc file is added as RESOURCE in the .pro file)

    Well, the problem is that when I make changes in MyComponent.qml and press "Run" or "Build Project", the changes are left out in the running program, I need to "Rebuild" to make any mínimum change in "MyComponent.qml" be considered. Why this happen?

    It's like any other qml files than main.qml are not recompilated when build or run the program.

    How can I make Qt Creator recompiles (or consider) all my qml files when Running or Building the Project?

    Thank you and sorry for my poor english.

  • Lifetime Qt Champion


    Because the qml files you have are compiled in your application when using qrc. That's why you have to build your application before you can see the changes.