Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946
Auto clean project during build process
My build settings for both Release and Debug have an entry for Clean Steps. However, when I run my app, there is no clean happening. If I actually do a Clean from the Build menu, then run my app, it is clear that the clean actually happened, but if I do not, there is no cleaning.
How can I ensure that cleaning always happens when I run the app?
The workaround I am searching for is a problem I'm having where QML file edits do not appear when I run the app, even if they are saved, unless I first clean the project. I can run the app two consecutive times with the only change being a manual Clean, and the output on the screen only reflects edits to my QML in the second run.
[quote author="qttester5" date="1390716465"]My build settings for both Release and Debug have an entry for Clean Steps. However, when I run my app, there is no clean happening. If I actually do a Clean from the Build menu, then run my app, it is clear that the clean actually happened, but if I do not, there is no cleaning.[/quote]That's expected. Clean Steps are only run when you ask Qt Creator to clean (e.g. Build -> Clean Project).
[quote]The workaround I am searching for is a problem I'm having where QML file edits do not appear when I run the app, even if they are saved, unless I first clean the project. I can run the app two consecutive times with the only change being a manual Clean, and the output on the screen only reflects edits to my QML in the second run.[/quote]When you build your project, it copies your .qml files into your build directory (which also contains your .exe file).
When you save your .qml file, it only updates your source directory -- it doesn't copy it into your build directory.
Now, there are 2 different run buttons:
- "Re-run this run-configuration" is the small green arrow in the "Application Output" tab. This button runs what is already in your build directory -- it does not update anything before running.
- "Run (Ctrl-R)" is the large green arrow on the left of Qt Creator, above the "Build Project" and "Start Debugging" buttons. This button checks if your source files -- if they have changed, it will re-build (and update your .qml files) before running.
Make sure you click on "Run (Ctrl-R)", not "Re-run this run-configuration". This will make your QML edits appear.
I always use the big Run button on the left sidebar of Qt Creator, or I use Control-R. I've never used the button in the Application Output tab. By my issue persists and I must clean after editing QML files if I want to see their edits when running the app.
Hmm... odd. What happens if you save your files, then click "Build" before "Run"?
T3STY last edited by
In QtCreator go to the Projects tab, then in the active configuration get to the Build Steps part. Press Add Build Step > Make and in the "Make arguments" box write clean. After that, move this step (using the buttons on the -top-left- top-right corner of the box) to be the first in the list.
At this point, every time you build with that configuration Qt will clean the project before building. If in the Build&Run settings (Tools > Options > Build & Run) you've set to always deploy before running it, then you will have a complete rebuild of the project with clean, build and run steps every time you run the project using QtCreator's main Run button. This does not affect the compile/build tab Run button which only executes the compiled project.
JKSH - Save All has no effect. Only Clean resolves the issue so I can see my edits.
T3STY - I will try adding the clean step as you mention. My Build & Run settings are already set to "Always build before deploying." and "Always deploy before running."
I meant Build, not Save All.
Build automatically runs when I press the Run button.
T3STY last edited by
If so, then you should be correctly set up... when you press "build" you have a clean step before anything, then it starts actually building. When you press "run" it will first build the project which in its turn will first perform the clean step, then build then run. Let me know if it does the trick.
Anyway, I'd like to warn you about always cleaning... maybe you're now having a quite small project and completely rebuilding it takes just a few seconds. But when you'll get to a quite large project it will take you ages to rebuild the whole project every time. You should try to solve that issue you're having in a different manner...
It appears as though this maybe a Qt bug that has already been logged. It requires that qmake be run after adding files to a resource file, otherwise those files will not get updated properly during build process. I have an open ticket and there is another open ticket on this issue as well.
Right, I completely forgot about resource files. I had assumed you deployed standalone .qml files.
Could you please post the links to your ticket and the other one you found? I'm sure others would be interested in following this issue too.
Having to manually run qmake is somewhat inconvenient. You'll need to do it if you, say, delete a file from your project, because the Makefile won't get regenerated. The build process fails because it's trying to build a file that no longer exists.