title: Qt - QStackedWidget usage
body: <p>In my mainwidow.cpp constructor, I do this:</p>
  
  <pre><code>TLDAlgoSettings = new TLDSettings(ui-&gt;algoSettingsStackedWidget);
  
  ui-&gt;algoSettingsStackedWidget-&gt;addWidget(TLDAlgoSettings);
  ui-&gt;algoSettingsStackedWidget-&gt;setCurrentWidget(TLDAlgoSettings);
  </code></pre>
  
  <p>TLDSettings being a QWidget :</p>
  
  <pre><code>#ifndef TLDSETTINGS_H
  #define TLDSETTINGS_H
  
  #include &lt;QWidget&gt;
  
  namespace Ui {
  class TLDSettings;
  }
  
  class TLDSettings : public QWidget
  {
      Q_OBJECT
  
  public:
      explicit TLDSettings(QWidget *parent = 0);
      ~TLDSettings();
  
  private:
      Ui::TLDSettings *ui;
  };
  
  #endif // TLDSETTINGS_H
  </code></pre>
  
  <p>Pretty simple; however, it looks like I am missing something since it does not work: my TLDSettings QWidget does not appear at its place when I do <code>ui-&gt;algoSettingsStackedWidget-&gt;setCurrentWidget(TLDAlgoSettings);</code></p>
  
  <p>Any suggestion?</p>
  
  <p><strong>[EDIT]</strong></p>
  
  <p>OK, I can confirm this works (still in mainwindow.cpp constructor):</p>
  
  <pre><code>TLDAlgoSettings = new TLDSettings();
  
  StackedWidget = new QStackedWidget;
  StackedWidget-&gt;addWidget(TLDAlgoSettings);
  
  ui-&gt;visionSettingsVerticalLayout-&gt;addWidget(StackedWidget);
  </code></pre>
  
  <p>Not a bad workaround, but still I wonder why the other option would not work.</p>