开发者

How to generate .h file out of qt .ui with visual studio 2008?

i only manage to find tutorials to generate in linux but can't find any guides 开发者_运维百科for generating in windows so i can use for vs2008. anyone can help? thanks!


Add your .ui files to the project, then right-click -> Properties. Under General->Item Type set Custom Build Tool. Under the left panel expand the Custom Build Tool goto General there set:

Command Line: "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)"
Description: UIC'ing %(Identity)...
Outputs: .\GeneratedFiles\ui_%(Filename).h
Additional Dependencies: $(QTDIR)\bin\uic.exe

The % variables are new to VS2010 but basically search for the one with the full path of the ui file and the dir where you want the generated .h to be output. Make sure Outputs also filled out correcty so it gets cleaned up on clean.


If all you want to do is generate a .vcproj from a Qt .ui file, and assuming that you already have Qt installed on Windows, here's the minimum you have to do.

  • Create a .pro file that lists your .ui file(s) in the FORMS line:
FORMS = myuifile.ui mynextuifile.ui
  • Save your .pro file and run qmake against it with these flags:
qmake -tp vc mypro.pro
  • This should generate mypro.vcproj.
  • Launch and build mypro.vcproj. This will generate the Visual Studio solution file and .h files for each of your Qt .ui files.


You may wish to have a look at the Qt Visual Studio Add-in, it integrates Qt GUI development with Visual Studio. You can download it here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜