Simple menubar using Qt4
Posted
by Buzz
on Stack Overflow
See other posts from Stack Overflow
or by Buzz
Published on 2010-04-28T11:25:06Z
Indexed on
2010/04/28
11:33 UTC
Read the original article
Hit count: 371
Hi all
i'm trying to make a simple GUI with QT 4.6. i made a separete class that represents the menu bar:
MenuBar::MenuBar()
{
aboutAct = new QAction(tr("&About QT"), this);
aboutAct->setStatusTip(tr("Show the application's About box"));
connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
quitAct = new QAction(tr("&Quit"),this);
quitAct->setStatusTip(tr("Exit to the program"));
//connect(quitAct, SIGNAL(triggered()), &QApp, SLOT(quit()));
menuFile = new QMenu("File");
menuFile->addAction(quitAct);
menuLinks = new QMenu("Links");
menuAbout = new QMenu("Info");
menuAbout->addAction(aboutAct);
addMenu(menuFile);
addMenu(menuLinks);
addMenu(menuAbout);
}
i can't connect the signal of the quitAct with the quit slot of the main application probably because it is not visible from the MenuBar class..
//connect(quitAct, SIGNAL(triggered()), &QApp, SLOT(quit()));
how can i do it?
© Stack Overflow or respective owner