1

I have created a QFrame with Qt designer, and now I'm trying to add a menubar. So far I have seen that I maybe should have used QMainWindow but I can't change the type anymore and I don't see any option to attach a menu.

I have tried to create an empty QMainWindow to see how it is done there. But I can only see a menubar entry with now way how to add menus and items to it. Using google also didn't yield anything.

Devolus
  • 21,661
  • 13
  • 66
  • 113

1 Answers1

1

I don't see any way to add a QMenuBar if you don't choose to create an empty QMainWindow, but if you do that, typing text into the "type here" area and pressing enter creates a new QMenu in the menu bar. There is also "type here" areas for each created menu, allowing you to add items (ie QActions) to menus. It worked at least with QtCreator 5.3.1.

BlackDwarf
  • 2,070
  • 1
  • 17
  • 22
  • I have to try that. So I should create that mainwindow, and then attach the frame, I already have, as a subwindow? – Devolus Jul 21 '14 at 19:44
  • Yes, I think this works, whilst keeping all the changes you made to your frame. – BlackDwarf Jul 21 '14 at 19:57
  • Thx! Do you know why I have a `centralwidget` which doesn't seem to expand to the full mainwindow size? – Devolus Jul 21 '14 at 20:03
  • It can be because the `centralwidget` you created have no layout. With a horizontal or vertical layout, your widget will normally fit the size of its parent, ie your mainwindow. – BlackDwarf Jul 21 '14 at 20:08
  • I managed it now, though it is still not 100% clear to me. :) – Devolus Jul 21 '14 at 20:13