[Qt-interest] 2 menubar not working

David Boosalis david.boosalis at gmail.com
Mon Sep 28 05:47:14 CEST 2009


Yes you can have have two menu bars.
Look at documentation for

 QMainWindow::addToolBarBreak ( Qt::ToolBarArea area =Qt::TopToolBarArea )

On Sun, Sep 27, 2009 at 4:23 AM, Sujan Dasmahapatra
<sujan.dasmahapatra at gmail.com> wrote:
> 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
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>




More information about the Qt-interest-old mailing list