Since the inclusion of range-for in C++11 we've being migrating our Qt code so it no longer uses the Q_FOREACH
/foreach
macros. To force the migration, we are manually adding the QT_NO_FOREACH
preprocessor define to every project we check. We use Visual Studio and the Qt VS Tools add-in.
My question is: Is there any way to automatically add such macro to new Qt projects? I've checked the global Qt VS Tools settings and there is nothing there. May be some hidden variable in the add-in we can change?
Obviously, we can just add them manually, but we'd prefer to have some do-it-once solution. We've also considered the use of property pages but they are either per-user based (not part of the repository, and would apply to all projects, not only Qt's), or must be manually included in the project (and in this case it would be easier to just add the define manually in the project settings).
Note: We are aware of the implications of migrating form Q_FOREACH
to range-for, and how to correctly make the change to avoid the COW penalization. In the case you want to read more about it please check here, here and here.