PDA

View Full Version : Adding a QT dialog in VS2003 doesn't generate files



jrbloch
7th June 2006, 00:05
I am using QT4.1.3 and QT Visual Studio Integration with Visual Studio 2003. Everything seems to work fine when I have an application with just one form, but when I try to add new dialogs to my project, I am running into problems.

When I create a new QT Application in VS2003, I get a default form with corresponding ui,cpp,h files and everything works fine. I can add a button to my form, and I can double click on this button to have an event handler automatically generated. That is great and that is what I expect, but when I go add a new form to my project, the only file that is generated is the ui file. How do I get the cpp and h files? Also, when I add a button to this new dialog and then double click on it in the designer, I don't get my auto generated event handler like I did in the main form. I would expect that when I add a new dialog to my project, I should get the same files generated that are generated for the main form. What am I doing wrong?

jpn
7th June 2006, 06:18
Sounds weird, but just to assure, did you setup correct Qt installation dir (Qt itself, not the integration) in VS (Tools->Options->Qt->Builds)?

Edit: Does an automatically generated template project compile fine? How do you add the form?

jrbloch
7th June 2006, 18:11
Under VS Tools->Options->Qt->Builds, I see
4.1.3 and its cooresponding path C:\Qt\4.1.3.
Under VS Tools->Options->Qt->general there is
Generated Files
- MocDirectory .\GeneratedFiles\$(ConfigurationName)
- UicDirectory .\GeneratedFiles
Misc
- AutoRunUic true
- AutoUpdateBuildSteps true

An automatically generated template project compiles and runs fine, and I can load existing QT4 projects, compile and build them as well.

The way I am trying to add a new dialog to the project is
VS File->Add New Item->QT Forms->QT Dialog Form

I can add the dialog and get only the ui file. It seems like uic is not being run. I tried manually running uic on a command line and only was able to get a .h file. When you add a dialog, do you get all the files generated for you?

jrbloch
9th June 2006, 15:17
It works only if you right click on the project you want to add the new form and then select Add ->Add Qt Gui class.

jpn
9th June 2006, 21:22
Ahh right. I've always used that way to add new qt ui classes.

It even kind of makes sense to me. A new file (File->New) is a single new file. The shortcut for adding a new .ui file with corresponding header and implementation files is a different thing than just adding a single new file (let it be any type of file).. I think it's a matter of taste ;)