You are not logged in.

klaus1111

Beginner

  • "klaus1111" started this thread

Posts: 7

Location: Germany-Stuttgart

  • Send private message

1

Tuesday, January 3rd 2006, 11:28am

menu in non QMainWidget Widget

Hi,
I want to have a menu in a non QMainWidget Widget.

After searching carefully this forum I found the following hint:

"Originally posted by Gabriel:
If you want to use a QMenuBar in a single QWidget, you have to create it as a child of a (thin) QFrame that itself is child of the QWidget, and added to a QWidget (horizontal) layout.
QMainWidget makes something like this for us (but without a layout). The menu bar is accessed by menuBar() and the status bar by statusBar().
You can see is by yourself in the open code..."


but - how to make a QMenuBar a "child of the QWidget" QFrame?

  • "wysota" is male

Posts: 4,276

Location: Warsaw, POLAND

  • Send private message

2

Tuesday, January 3rd 2006, 11:33am

RE: menu in non QMainWidget Widget

Insert a QFrame onto your widget and the rest of the widget content below it. Then apply a vertical layout with margins set to 0 (to move the frame as close to the top border as possible). Then insert a QMenuBar object into the frame. You can try doing that without a frame too.

klaus1111

Beginner

  • "klaus1111" started this thread

Posts: 7

Location: Germany-Stuttgart

  • Send private message

3

Tuesday, January 3rd 2006, 11:40am

RE: menu in non QMainWidget Widget

hm - and if the Widget is created via designer? I didn't found a QMenuBar object there which I could insert into the frame...

  • "wysota" is male

Posts: 4,276

Location: Warsaw, POLAND

  • Send private message

4

Tuesday, January 3rd 2006, 11:42am

RE: menu in non QMainWidget Widget

You can't do it via designer. Subclass and implement the menu in code.