Qt4: QMenuBar/QMenu doesn't show up on Mac OS X

Posted by Erick on Stack Overflow See other posts from Stack Overflow or by Erick
Published on 2010-03-17T05:15:17Z Indexed on 2010/03/17 5:21 UTC
Read the original article Hit count: 384

Filed under:
|

Hello,

I'm having difficulties to make a QMenuBar display a QMenu with a QAction under Mac OS X (Snow Leopard).

Here is the code I'm using for creating the menu:

void ClientWindow::setUpMenu ()
{
   QMenu * file = menuBar()->addMenu("&File");
   QAction * quit = new QAction("&Quit", this);
   file->addAction(quit);

   connect(quit, SIGNAL(triggered()), this, SLOT(quit()));
}

Here is the ClientWindow class interface:

class ClientWindow : public QMainWindow
{
    public:
        ClientWindow (QWidget * parent = 0);
        void setUpMenu ();
};

And here is my main() method:

int main (int argc, char * argv[])
{
    QApplication app(argc, argv);
    ClientWindow window;

    window.setUpMenu();
    window.show();

    return app.exec();
}

Any ideas why it wouldn't show up on the menu bar? Thank you all.

© Stack Overflow or respective owner

Related posts about qt4

Related posts about mac