The custom build to generate the moc for the header is not set when the header is added with Visual Studio wizard ( "Add -> New Item..." )
- Create a Qt project with Visual Studio 2013
- Add -> New Item...
- Choose Header file (.h)
- Build solution
1>------ Build started: Project: Test, Configuration: Release x64 ------
1>c1xx : fatal error C1083: Cannot open source file: 'Moc\moc_MyFile.cpp': No such file or directory
Removing and then adding the Q_OBJECT does not generate the moc but it is working fine if I add the file with "Add -> Existing item..." So as long as a file is added with "Add -> New item..." there is no way to have the moc file