PDA

View Full Version : QT Open Source, Designer and MSVC++



bradcb212
4th October 2007, 03:39
I followed the tips on compiling QT for MSVC2005 and creating .vcproj files. I successfully compiled a Hello World! QT Example in MSVC++....

Now I'm trying to use QT Designer with msvc++ 2005...

I made a simple dialog following a tutorial, I saved the form (.ui file) to my project's directory

I redid this

qmake -project -t vcapp -o helloqt.pro
qmake

in a command prompt

When I opened the .vcproj file again, there was a new folder called "Generated Forms" in the solution explorer

this folder pointed to files moc_mainwindow.cpp and moc_mainwindow.h, which unfortunately do not exist...

Note, there's also a folder called "Form files" which contains the .ui file I created earlier

It would appear that I'm onto something, but I haven't gotten to the point that I can save a .ui file, compile my project with glue code and pop up my new GUI..

What did I do wrong?

rajesh
4th October 2007, 06:52
this folder pointed to files moc_mainwindow.cpp and moc_mainwindow.h, which unfortunately do not exist...

these file is required if you have Q_OBJECT micro in your class. means you using signal and slot.
for creating these file you need to compile mainwindow.h

Do the following steps:
1. right clickon mainWindow.h in explorer tree branch, then select properties.
in properties window goto Custom Build Step-->General then enter in
Command line field : "%qtdir%\bin\moc.exe" "$(InputDir)$(InputName).h" -o "$(InputDir)moc_$(InputName).cpp"

note: here qtdir is environment variable which have path of Qt or you can write Path of Qt directly.

output field: $(InputDir)moc_$(InputName).cpp

2. right click on mainWindow.h then select compile. this process will generate moc_mainwindow.cpp and moc_window.h

3. you add this in "Generated " tree branch.

now you can build your application.