View Full Version : Qt Designer - creating a form that includes a menu bar only.

3rd July 2007, 07:48

Does anyone know if you can create a mainform using Qt3 Designer that includes a height equal to zero. (i.e. all i want is a form that includes the menu bar and no body).

I have tried setting minimum height to zero and then setting preferred height to minimum in the form properties but this did not solve the problem.

I was thinking i may have to code up this form outside Qt designer but was just checking in case someone had encountered this and solved this problem previously,

Thanks in advance,


3rd July 2007, 08:01
What is the point of creating such a form?

3rd July 2007, 08:05
Porting a legacy motif application to qt, not sure why they did it this way,

I have tried manually setting the height in the .ui xml file to zero but i think it may be a qt designer limitation?

3rd July 2007, 10:23
I suggest you do it the proper way instead of forcing odd design.

4th July 2007, 15:41
coding by hand i have made a QMainWindow dialog and used the widget class public method "setFixedHeight()" to set the height = 0, (which half worked, ie there is a small area below the menu bar) and "setFixedWidth()"(which did not work, ie goes to a max limit, but window can still be shrunk thinner)

Is there other way to keep only the menu bar, and no area below the menu bar?

4th July 2007, 16:06
Yes. Use QMenuBar instead of QMainWindow.

5th July 2007, 02:00
Ah ha, thank you very much, worked perfectly!!!

cheers heaps for your help, im a newbie to Qt and C++, so your help is very appreciated.