PDA

View Full Version : Qt 4 and Visual Studio 2005 Add-in project



JSPoly
22nd January 2007, 22:20
Hi,

I need to use Qt4 to create a GUI in a Visual Studio 2005 add-in project. Is there a way to do this? :confused:

Thanks

Chicken Blood Machine
23rd January 2007, 05:31
Yes .

JSPoly
23rd January 2007, 15:25
Yes, you mean there is a way to have automaticaly generated .h, .cpp, and the code to generate the QMainWindow in a Add-in project. If the anwser is still yes, please describe a quick walkthrough.

Thanks.

Chicken Blood Machine
23rd January 2007, 17:21
When you say "Add in" I presume that you are using the Visual Studio Add-in that comes with the commercial version of Qt?

If so, the instructions to do this should have been provided with the Add-in. Take a look at this thread if you have problems:

http://lists.trolltech.com/qt-interest/2006-04/thread00449-0.html

Without the Add-in, you will have to set up the project manually, you can add custom build rules in Visual Studio for UI files and mocable headers. See here for more info:

http://doc.trolltech.com/4.2/uic.html
http://doc.trolltech.com/4.2/moc.html

The rules are for make, but you should be able to translate them into VS custom build syntax.

JSPoly
23rd January 2007, 19:20
No, I already install the Qt4 integration on visual studio. With that I know Qt projects are available and I know how to use it, but thats not what I want. What I want is when I create a Visual Studio add-in, to be able to have all the generated files in that project when I visually construct a .ui. Otherwise I have to make a Qt project and integrate it "manualy" in my add-in project. Not very practical!

Chicken Blood Machine
23rd January 2007, 19:35
I think I see what you mean (A VS 'Add-in' is a plugin for Visual Studio, right?).

It seems like you have two choices then:

1) Create a VS add-in project, add the build rules for each ui/mocable file manually (as you say, not very practical, but not too much trouble if you only have a few files that need it).
2) Create a Qt project and see how it differs to an Add-in project. Then canibalize the bits from the Add-in project that you need to turn the Qt project into an Add-in project.

I no longer work on the Windows platform, so I don't have VS in order to see how to do this. Maybe someone else can help. Try experimenting in the meantime.

gri
23rd January 2007, 19:44
In Visual Studio 2005 you can define your own build rules for .ui files. In the .net 2003 version it's too much work ...

JSPoly
23rd January 2007, 20:50
Yes, I think making my own build rule is the best way to do it. Any walkthrough on that?

gri
23rd January 2007, 21:16
Simply click on a project, open the context menu and navigate to "Custom Build Rules ...". There are already two items added, you can use them as example. It's very easy, about one minute of work :)

JSPoly
23rd January 2007, 22:01
I looked at those rule files and I didn't understand how to use it. Maybe a little more explanation could help me. Thanks.

gri
23rd January 2007, 22:33
I looked at those rule files and I didn't understand how to use it. Maybe a little more explanation could help me. Thanks.

I've added a build rule for the .ui files. You can add it by opening the context menu on a project, navigating to "Custom Build Rules ..." -> "Find Existing ...".

You may add another rule for the meta object compiler. It's much more work than using a Qt makefile. Thats why I'm using Visual Studio with makefiles.