Author Topic: How to use Qt Designer with C::B? (Yes, I have the plugin! :) )  (Read 4280 times)

Offline DiBosco

  • Single posting newcomer
  • *
  • Posts: 5
How to use Qt Designer with C::B? (Yes, I have the plugin! :) )
« on: November 15, 2008, 09:01:34 pm »
Hi Folks,

I'm trying to get Qt designer .ui files to work with C::B under Windows XP. I have installed the Qt plugin and I can compile the simple "quit" program no problem. I have then made a simple .ui file with just a button and label. I can then add the .ui file to the project, but although it show up in the "others" space, it doesn't generate any code on compile. I have been and created an extra .cpp file that attempts to knit together manually the widgets placed on the .ui form, but I just cannot get that to compile at all. 

I followed a tutorial that was not a C::B tutorial and kind of made sense, tying up with some KDevelop work I've previously done. However is baulks at this line:

class test : publin QWidget, private ui::testDLG

I get the error "'UI' has not been declared"

Am I expecting something that just doesn't work with this set-up? Should I be able to place widgets with Qt designer and then use C::B to somehow generate code in the same way KDevelop does under Linux?

If I have to do it all manually, is there a tutorial anywhere that sets it out in terms for a real newbie like me who is shooting in the dark? If not, does anyone have a very, very simple project that just has a button pressed that calls something else so I can just get an idea of how it works please?

I can see how to do it without Qt designer, but that really is a grade one PITA and very slow!

Many thanks for any help.
« Last Edit: November 15, 2008, 09:03:47 pm by DiBosco »

Offline DiBosco

  • Single posting newcomer
  • *
  • Posts: 5
Re: How to use Qt Designer with C::B? (Yes, I have the plugin! :) )
« Reply #1 on: November 24, 2008, 04:33:59 pm »
After a week of on and off struggling I finally made some progress. Turns out you have to run two programs:

uic

This makes the ui_filename.h headers that automatically get done with KDevelop.

and

moc

This makes a filename.moc file that you need to put as a #include at the end of your .cpp file that is linked to your ui.file.

I ended up writing a little batch file that I always run before compiling in C::B and that seems to work ok. I guess there might be a way of automating it when you hit compile but I'm buggered if I can work it out!

Hope this makes sense and stops someone else doesn't keep banging their head against a brick wall. Maybe I'm the only user on this forum who has tried C::B with Qt4, but there might be someone else in the future who uses it. :)