PDA

View Full Version : QMenu and setTearOffEnabled(bool)



dvmorris
8th April 2007, 00:09
I'm trying to make some menu's tearoff-able, and it doesn't seem to work on OS X, I haven't tried any other OS yet, so I don't really know what's wrong. Here is some code I'm using:



//in .hh file
QMenu *editMenu;

//in .cc file
editMenu = menuBar->addMenu(tr("&Edit"));
editMenu->addAction(undoAct);
editMenu->addAction(redoAct);
editMenu->setTearOffEnabled(true);




menuBar = new QMenuBar(0);

fileMenu = new QMenu(tr("&File"),this);
fileMenu->setTearOffEnabled(true);
menuBar->addMenu(fileMenu);
fileMenu->addAction(openAct);
fileMenu->addAction(saveAct);
fileMenu->addAction(saveAsAct);
fileMenu->addSeparator();
fileMenu->addAction(exitAct);


any ideas? I'm clueless. It compiles and runs, but the tearoff strip doesn't show up anywhere...

hickscorp
8th April 2007, 00:16
Hello,

I tried on a windows OS, and the only thing i had to change so it works is the parent object you give to the constructor:
i would use
new QMenuBar(this);
rather than
new QMenuBar(0);

But maybe there is a subtility i didnt get :)
Hope it helps ^^
Pierre.

dvmorris
8th April 2007, 00:59
I tried that and it doesn't seem to work either. It must be an OS X thing. I'll try on windows later. Thanks for your help, if anyone else knows anything, let me know,
Dave

dvmorris
9th April 2007, 02:18
found this link just now while searching on the trolltech support site:

http://www.trolltech.com/developer/task-tracker/index_html?method=entry&id=144056

I hope they fix this soon...