[Qt-interest] 2 menubar not working
Sujan Dasmahapatra
sujan.dasmahapatra at gmail.com
Sun Sep 27 13:23:50 CEST 2009
Dear Friends
I have a doubt ! Can we have 2 menuBar() for a single QMainWindow ?
Sometimes I want to use 1 menuBar and sometimes I want to goto to a
different mode where a 2nd menuBar should come.
Is this code below correct would there be corresponding menuBars will be set
when user wants to change the menuBar !!
Kindly see the code snippet :
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class MainWindow:public QMainWindow
{
private:
QMenuBar *menuBar1, * menuBar2;
QPushButton * button1, *button2;
protected slots:
void callMenuBar1();
void callMenuBar2();
}
MainWindow::MainWindow()
{
menuBar1 = new QMenuBar;
menuBar2 = new QMenuBar;
button1 = new QPushButton;
button2 = new QPushButton;
connect(button1,SIGNAL(clicked()),this,SLOT(callMenuBar1()));
connect(button2,SIGNAL(clicked()),this,SLOT(callMenuBar2()));
}
void MainWindow::callMenuBar1()
{
setMenuBar(menuBar1);
}
void MainWindow::callMenuBar2()
{
setMenuBar(menuBar2);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
--
Thanks & Regards
S. Dasmahapatra
B.E. (Aeronautics-Aerodynamics)
Bangalore, India
Ph:91-9900839788
Office:91-80-66470248
mail id : sujan.dasmahapatra at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090927/79feeb74/attachment.html
More information about the Qt-interest-old
mailing list