title: Switching between one QToolButton to another in QT
body: <p>I want to switch from one <code>QToolButton</code> to another in <code>QToolBar</code>. I have used <code>QStackedWidget</code>, their it is too simple to move from one <code>widget</code> to other but here I am not able to get how to move via using <code>keyReleaseEvent</code>.</p>
  
  <pre><code>mywindow::mywindow() : QMainWindow()
  {   
      widget = new QWidget();
      setCentralWidget(widget);
  
      tool = new QToolBar();
      vertical = new QVBoxLayout();
      button1 = new QToolButton();
      connect( button1, SIGNAL(clicked()), this, SLOT(fileNew()) );
  
      button2 = new QToolButton();
      button3 = new QToolButton();
  
      button1-&gt;setIcon(QIcon("download.jpg"));
      button1-&gt;setGeometry(0,0,100,200);
      button2-&gt;setIcon(QIcon("images.jpg"));
      button3-&gt;setIcon(QIcon("settings-icon.jpg"));
  
      //stack1-&gt;addWidget(button1);
      //stack1-&gt;addWidget(button2);
      //stack1-&gt;addWidget(button3);
  
      tool-&gt;addWidget(button1);
      tool-&gt;addWidget(button2);
      tool-&gt;addWidget(button3);
      //tool-&gt;addWidget(stack1);
  
      vertical-&gt;addWidget(tool);
      widget-&gt;setLayout(vertical);
  }
  
  void mywindow::keyReleaseEvent(KeyEvent *event)
  {
      switch(event-&gt;key())
      {
          case:Qt::Key_Left:
  
  
      }
  }
  </code></pre>