title: Adding layout under QStackedWidget in Qt
body: <p>How can i add different layouts under <code>QStackedWidget</code>. I have 3 <code>QVBoxLayout</code> and i want to add this <code>QVBoxLayout</code> under <code>QStackedWidget</code>. I know layout cant add inside widget. but is there is any way to do that. So that from <code>QStackedWidget</code> i can change different <code>layout</code>.</p>
  
  <pre><code>mywindow::mywindow() : QMainWindow()
  {   
      centralWidget = new QWidget(this);
      setCentralWidget(centralWidget);
      layout1 = new QVBoxLayout(centralWidget);
      layout2 = new QVBoxLayout();
      layout3 = new QVBoxLayout();
  
      stack1 = new QStackedWidget();
      list1 = new QListWidget();
      list2 = new QListWidget();
      list3 = new QListWidget();
      label1 = new QLabel("Main Menu");
      label2 = new QLabel();
      label3 = new QLabel("Hello");
      label4 = new QLabel("Hi");
      line1 = new QLineEdit();
  
      list1-&gt;addItem("Item 1");
      list1-&gt;addItem("Item 2");
      list1-&gt;addItem("Item 100");
  
      list2-&gt;addItem("Item 3");
      list2-&gt;addItem("Item 4");
  
      list3-&gt;addItem("Item 5");
      list3-&gt;addItem("Item 6");
  
  
      layout1-&gt;addWidget(label1);
      layout1-&gt;addWidget(list1);
      layout1-&gt;addWidget(label2);
  
      layout2-&gt;addWidget(label3);
      layout2-&gt;addWidget(list2);
  
      layout3-&gt;addWidget(label4);
      layout3-&gt;addWidget(list3);
  
      stack1-&gt;addWidget(layout1);
      stack1-&gt;addWidget(layout2);
      stack1-&gt;addWidget(layout3);
  
      this-&gt;setLayout(layout);
  
  }
  </code></pre>