title: QGroupBox Display
body: <p>Could some one help me on my code issue</p>
  
  <p>I use 2 Push buttons (in Qt GUi Program) ( 1st, 2nd ) in the bellow code</p>
  
  <p>Initial Image</p>
  
  <p><img src="https://i.stack.imgur.com/6fWK9.png" alt=""></p>
  
  <p>1) When I press 1st Push Button, the output in Gbox .. When 1st button pressed</p>
  
  <p>1st push button clicked</p>
  
  <p><img src="https://i.stack.imgur.com/IMwzr.png" alt=""></p>
  
  <p>2) When I Press 2nd Push Button the expected output should be like Expected output in Gbox after pressing 2nd button</p>
  
  <p>Expected when 2nd Push button Clicked</p>
  
  <p><img src="https://i.stack.imgur.com/XqJNk.png" alt=""></p>
  
  <p>But no changes after pressing 2nd button in Gbox.. No Changes after pressing 2nd Button</p>
  
  <p>No_changes in Gbox_2nd Push Button Selected</p>
  
  <p><img src="https://i.stack.imgur.com/1cTAJ.png" alt=""></p>
  
  <pre><code>#include "test.h"
  #include "ui_test.h"
  #include &lt;QPushButton&gt;
  #include &lt;QCheckBox&gt;
  #include &lt;QVBoxLayout&gt;
  #include &lt;QtWidgets&gt;
  #include &lt;QLineEdit&gt;
  #include &lt;QTextEdit&gt;
  #include &lt;QGridLayout&gt;
  #include &lt;QVBoxLayout&gt;
  #include &lt;QGroupBox&gt;
  
  test::test(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::test)
  {
      ui-&gt;setupUi(this);
      QVBoxLayout *mainLayout = new QVBoxLayout;
  
      ui-&gt;label_1-&gt;hide();
      ui-&gt;label_2-&gt;hide();
      ui-&gt;label_3-&gt;hide();
      ui-&gt;label_4-&gt;hide();
      ui-&gt;label_5-&gt;hide();
      ui-&gt;label_6-&gt;hide();
      ui-&gt;label_7-&gt;hide();
  
      ui-&gt;lineEdit_1-&gt;hide();
      ui-&gt;lineEdit_2-&gt;hide();
      ui-&gt;lineEdit_3-&gt;hide();
      ui-&gt;lineEdit_4-&gt;hide();
      ui-&gt;lineEdit_5-&gt;hide();
      ui-&gt;lineEdit_6-&gt;hide();
      ui-&gt;lineEdit_7-&gt;hide();
  
      ui-&gt;Optional-&gt;hide();
  
      Gbox-&gt;setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Maximum);
      Gbox-&gt;setTitle(tr("Gbox_11"));
  
      mainLayout-&gt;addWidget(Gbox);
      setLayout(mainLayout);
  }
  
  test::~test()
  {
      delete ui;
  }
  
  void test::on_1st_clicked()
  {
      ui-&gt;label_1-&gt;show();
      ui-&gt;lineEdit_1-&gt;show();
      ui-&gt;label_1-&gt;setText("R : ");
  
      ui-&gt;label_2-&gt;show();
      ui-&gt;lineEdit_2-&gt;show();
      ui-&gt;label_2-&gt;setText("ID : ");
  
      ui-&gt;label_3-&gt;show();
      ui-&gt;lineEdit_3-&gt;show();
      ui-&gt;label_3-&gt;setText("X : ");
  
      ui-&gt;label_4-&gt;show();
      ui-&gt;lineEdit_4-&gt;show();
      ui-&gt;label_4-&gt;setText("Y : ");
  
      ui-&gt;Optional-&gt;hide();
      ui-&gt;label_5-&gt;hide();
      ui-&gt;label_6-&gt;hide();
      ui-&gt;label_7-&gt;hide();
      ui-&gt;lineEdit_5-&gt;hide();
      ui-&gt;lineEdit_6-&gt;hide();
      ui-&gt;lineEdit_7-&gt;hide();
      ui-&gt;Gbox-&gt;show();
  
      QPushButton *Road = new QPushButton("R");
      QPushButton *Junction = new QPushButton("J");
      QPushButton *Lane = new QPushButton("L");
      QPushButton *Objects = new QPushButton("O");
      QPushButton *Vehical = new QPushButton("V");
      QPushButton *Fupdates = new QPushButton("F");
  
      glay = new QGridLayout;
  
      glay-&gt;addWidget(Road,0,0,1,1);
      glay-&gt;addWidget(Junction,1,1,1,1);
      glay-&gt;addWidget(Lane,2,0,1,1);
      glay-&gt;addWidget(Objects,3,1,1,1);
      glay-&gt;addWidget(Vehical,4,2,1,1);
      glay-&gt;addWidget(Fupdates,5,3,1,1);
  
      setLayout(glay);
  
      ui-&gt;Gbox-&gt;setLayout(glay);
  }
  
  void test::on_2nd_clicked()
  {
      ui-&gt;label_1-&gt;show();
      ui-&gt;lineEdit_1-&gt;show();
      ui-&gt;label_1-&gt;setText("J: ");
  
      ui-&gt;label_2-&gt;show();
      ui-&gt;lineEdit_2-&gt;show();
      ui-&gt;label_2-&gt;setText("ID : ");
  
      ui-&gt;label_3-&gt;show();
      ui-&gt;lineEdit_3-&gt;show();
      ui-&gt;label_3-&gt;setText("X : ");
  
      ui-&gt;label_4-&gt;show();
      ui-&gt;lineEdit_4-&gt;show();
      ui-&gt;label_4-&gt;setText("Y : ");
  
      ui-&gt;Optional-&gt;show();
      ui-&gt;Gbox-&gt;show();
  
      QPushButton *A = new QPushButton("1");
      QPushButton *B = new QPushButton("2");
      QPushButton *C = new QPushButton("3");
      QPushButton *D = new QPushButton("4");
      QPushButton *E = new QPushButton("5");
      QPushButton *F = new QPushButton("6");
  
      vlay = new QVBoxLayout;
  
      vlay-&gt;addWidget(A,1);
      vlay-&gt;addWidget(B,0);
      vlay-&gt;addWidget(C,0);
      vlay-&gt;addWidget(D,1);
      vlay-&gt;addWidget(E,1);
      vlay-&gt;addWidget(F,0);
      setLayout(vlay);
  
      ui-&gt;Gbox-&gt;setLayout(vlay);
  }
  
  void test::on_Optional_stateChanged()
  {
      if(ui-&gt;Optional-&gt;isChecked())
      {
          ui-&gt;label_5-&gt;show();
          ui-&gt;label_5-&gt;setText("P :");
  
          ui-&gt;label_6-&gt;show();
          ui-&gt;label_6-&gt;setText("S 1 :");
  
          ui-&gt;label_7-&gt;show();
          ui-&gt;label_7-&gt;setText("S 2 :");
  
          ui-&gt;lineEdit_5-&gt;show();
          ui-&gt;lineEdit_6-&gt;show();
          ui-&gt;lineEdit_7-&gt;show();
      }
      else
      {
          ui-&gt;label_5-&gt;hide();
          ui-&gt;label_6-&gt;hide();
          ui-&gt;label_7-&gt;hide();
          ui-&gt;lineEdit_5-&gt;hide();
          ui-&gt;lineEdit_6-&gt;hide();
          ui-&gt;lineEdit_7-&gt;hide();
      }
  }
  </code></pre>