Dump bug report.
Custom build rule for file QTMAINWINDOW.H produces file MOC_QTMAINWINDOW.CPP
Yes, but CodeBlocks know nothing about produced file.
So, the problem exists, but more specific now:
When we have custom build for a file, and there is a produced file from this build, then somewhere in CodeBlocks we must define the name of produced file. So, the CodeBlocks when try to build the file, to check first if produced file exists and it is newer than source.