PDA

View Full Version : QT on VS2008 workflow



killrazor
19th January 2010, 23:22
Hi all,

Well, my question is: What's the best way to take profit of the QT designer instaled as a Visual Studio Add-in?
I'm trying to do the same example that I did in this pos (http://www.qtcentre.org/threads/27308-Why-this-error?p=129488#post129488)t but using QT Designer. The expample is very easy. A button and a LCD Number that increases on every click in the button. No more, no least.

In a fresh new project of QT, using QT designer, I put the button and a QLCDNumber. Here I found my first problem. I need a slot that increases the inner counter when button is clicked. Then I have three different ways to solve the problem.

1st: Close the designer and code all by hand.
2nd: Create a Subclass of QLCDNumber in a separate file. Then, into designer, promote the lcdCounter from QLCDNumber to LCDCounter, adding the recent created file (lcdCounter.h). That aproach has a problem: the increase() slot doesn't appear in the signal editor, so I need to modify the code in the autocreated class.
3th: Create the entire widget without QLCDNumber in designer, then subclass the whole widget and adding the customized stuff.

So, in your opinion, what is the correct way to use the designer with Visual Studio?

killrazor
22nd January 2010, 10:01
I reply myself:
After some time investigating, I've read that there are two ways to use custom widget in the designer.

1st one is to subclass a Widget, then put in the editor the base widget and promote the widget to our custom widget. The drawback is that designer is unable to work with the custom properties as new signal and slots.
2nd one is to start a custom widget lib in the new project dialog in Visual Studio, code your widget, build in release mode and the copy the results (lib, dll) to plugins/designer folder. The designer then is able to work with all the prcustom properties of your widget. Also the new widget is available for future projects.