PDA

View Full Version : Issues with Uic.



queelius
1st December 2010, 01:00
I just installed Qt 4.7.1 and hooked it up to Visual Studio 2010. I designed a widget in Qt Designer, then compiled it with Uic. However, the interface file this generates seems to be creating a small problem when I use the QDialogButtonBox widget to create two standard dialog buttons, Ok and Cancel.

Specifically, whenever I try to refer to one of the methods for one of the buttons in a QDialogButtonBox, it complains that said button isn't defined, e.g.:

buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false)

doesn't work. And, if I try to compile it, I get a QPushButton undefined error due to the above line of code. I was able to resolve this problem by hand-editing the interface file by adding the following line of code:

#include <QtGui/QPushDown>

But this isn't ideal, as I have to do a song and dance to disable autocompiling the ui file with Uic, resolve where the problem is, and hand-edit the autogenerated code.

So, I guess my question is, is this setup -- Qt + Visual Studio 2010 -- relatively painless to develop in for newbies, or can I expect continued problems? The reason I ask is because I'm investigating whether to use this to teach an introductory programming lab at a college (for which I'm a masters student) and I don't want the students (many of which will be new to programming) to have to tinker around with that sort of thing. GUI programming is not the focus, so it can't get in the way.

Added after 13 minutes:

Ooops, I should have posted this in the Newbie section. Sorry.

franz
1st December 2010, 07:19
Include the QPushButton in the source file where you actually use the push button instead. Saves you the head ache.

queelius
2nd December 2010, 12:02
Your advice is actually the sane way to address my "issue."

I humbly thank you.

marcvanriet
2nd December 2010, 12:54
So, I guess my question is, is this setup -- Qt + Visual Studio 2010 -- relatively painless to develop in for newbies, or can I expect continued problems? The reason I ask is because I'm investigating whether to use this to teach an introductory programming lab at a college...and I don't want the students... to have to tinker around with that sort of thing.

IMHO QtCreator is the easiest way to start using Qt for beginners. No more tinkering required whatsoever. It works both with the MingW and Visual Studio compiler.

Best regards,
Marc

P.S. I bet the professional (paid for) pluging for Visual Studio is also very good, but I guess the school won't pay for all of that for an introductory class. The free plugin has limitations that makes it less easy compared to using QtCreator.

squidge
2nd December 2010, 14:37
I was under the impression that the paid for plugin for Visual studio is no longer maintained. The newest version of the plugin is now the free version.

However, when I was using the paid-for version at a company earlier this year, it didn't seem that much different apart from the fact that things like QtDesigner are built into the Visual Studio IDE rather than running QtDesigner itself as in the free version.