PDA

View Full Version : Dialogs and MenuBar



vieraci
28th April 2009, 16:14
I don't see any way how to add a menuBar to a QDialog, only to QMainWindow. Is it possible ?

spirit
28th April 2009, 16:23
no, you can't add a menu bar in a dialog, only QMainWindow can have a menu bar.

vieraci
28th April 2009, 16:31
Well, I was just about to try and delete this thread because I did manage to add a toolBar to a dialog, with code.


QMenuBar *menuBar = new QMenuBar(this);

spirit
28th April 2009, 16:36
but it's not right, because QDialog has not a place for a menu bar, but QMainWindow has. maybe it's better yo use QToolButton with menus.

vieraci
29th April 2009, 00:06
No, I've written apps like this with other libraries, it works fine.
QMainWindow is still just a dialog but with some extra functions built on top.
It threw me when I didn't see how to do this with the designer. I guess they figured most people would not want a menu bar on a dialog.

mcosta
30th April 2009, 08:30
Read this http://developer.kde.org/documentation/standards/kde/style/basics/badInterface.html