简体   繁体   中英

How to Force Qt Visual Studio Add-in to Update Custom Build Steps to Create MOC Files

I'm dealing with a situation where I need to convert a number of Visual Studio files from a home-grown solution for processing resource, UI files, and creating MOC files from includes to using the Qt Visual Studio add-in. Unfortunately, the only way I could figure out to force the add-in to correctly process the files is to remove them and add them back. That's easier said than done, especially since this is a legacy system and some directories have multiple applications in the folder. I can't just remove all includes and add them back; I have to filter the ones that are appropriate. It's also made more difficult when the project uses folders to organize because then I have to remove the include files from a folder and add only those back to that folder and proceed to the next. I searched for answers on this, and the only thing I found was a similar 5-year-old question on the Qt form that no one ever answered.

I don't have a solution for .qrc and .ui files, but for generating MOC files from include files, I found that the following works.

  1. Use mass Find/Replace to change all Q_OBJECT macros to something unique; I used TCEJBO_Q.
  2. Save all changed files.
  3. Use mass Find/Replace to restore the macros back to Q_OJBECT.
  4. Save all changed files. At this point, the add-in will kick in and generate the build steps to create MOC files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM