PDA

View Full Version : QMenuBar and QGraphicsScene



Baleg
20th April 2011, 21:39
Hi all,

I'm developing an OpenGL application using QT for the overlay. Or at least that's the goal. I've been using the "modelviewer" example as reference ( git://gitorious.org/qt-labs/modelviewer.git ), but now I'm stuck trying to add a simple menu bar. I don't know if I'm doing something wrong or if there is a bug, but I can't get it to work.

In the example, I would for example add the following code to the OpenGLScene constructor:


QMenuBar* pMenuBar = new QMenuBar();
QMenu* pMenu = pMenuBar->addMenu("File");
pMenu->addAction("asd");
pMenuBar->addAction("Test");
pMenuBar->addAction("x");
pMenuBar->addAction("y");
pMenuBar->addAction("z");

//pMenuBar->setMinimumHeight(25);

addWidget(pMenuBar);

Like this, the menu bar doesn't even appear. Now if I comment out the setMinimumHeight() function, a gray rectangle appears (the menu bar), but without any menus.

The attached screenshot shows the menu bar below (?!) the "Instructions" dialog. There is also a lot of noise around the scene that I can't explain...

Any help would be welcome !