title: QStackedWidget navigation from page to page
body: <p>I think i'm having a fairly basic Qt problem, but i can't figure it out:</p>
  
  <p>I have a QMainWindow which holds a QStackedWidget. All page widgets in there are seperate classes derived from QWidget.</p>
  
  <p>So:</p>
  
  <p>QMainWindow implements QStacked Window in one class.
  All other pages inside the stacked widget are added classes and all have there own .ui filled with buttons and lists trough the Designer.</p>
  
  <p>For navigating to different pages, inside the Mainwindow i have access to: <code>ui.stackedWidget-&gt;setCurrentIndex(2);</code></p>
  
  <p>It seems i don't have access to ui.stackedWidget on another page inside the stacked widget? I have no access to the ui.stackedWidget because Ui is a private member in the mainwindow class. (auto generated by Qt - using VS addon for adding QT4 classes)</p>
  
  <p>I would like to know, how can i jump to another page in the stacked widget, when clicking on a button that belongs to another page inside this widget?</p>
  
  <p>Note:</p>
  
  <p>All pages are added to the StackedWidget in mainWIndow's constructor:</p>
  
  <pre><code>ui.stackedWidget-&gt;addWidget(page1Widget);
  ui.stackedWidget-&gt;addWidget(page2Widget);
  // etc..
  </code></pre>
  
  <p>Example of a button click signal-slot inside page1Widget:</p>
  
  <pre><code>connect(ui.btnViewData, SIGNAL(clicked()), this, SLOT(viewData()));
  
  ::viewData() 
  {   
     // navigate to another page here. 
     // note: ui.stackedWidget-&gt;setCurrentIndex(3); is not accessible here!
  }
  </code></pre>