Hi all,

I have a QDockWidget (within a QMainWindow) that contains a custom outterWidget QWidget. The outterWidget has
1) an innerWidget QWidget which contains x number of widgets (QLineEdit and QLabel widgets) depending on the program condition
2) a horizontal line
3) a push button

for layouts, outterWidget is set to QGridLayout
Qt Code:
  1. QGridLayout *gridLayout = new QGridLayout(this);
  2. gridLayout->setSpacing(5);
  3. gridLayout->setMargin(2);
  4. gridLayout->addWidget(innerWidget, 0, 0, 1, 3);
  5. gridLayout->addWidget(ui.line, 1, 0, 1, 3);
  6. gridLayout->addWidget(ui.runBtn, 2, 1, 1, 1);
To copy to clipboard, switch view to plain text mode 
innerWidget QWidget also has a QGridLayout that takes in an integer of how many row QLineEdit and QLabel to create
Qt Code:
  1. QGridLayout *mainLayout = new QGridLayout(this);
  2. mainLayout->setSpacing(5);
  3. mainLayout->setMargin(2);
  4. for (int i=0; i<nParams; ++i)
  5. {
  6. int col = 0;
  7. QLabel* label = new QLabel("test");
  8. QLineEdit* lineEdit = new QLineEdit();
  9. mainLayout->addWidget(label, i, col++);
  10. mainLayout->addWidget(lineEdit, i, col++);
  11. }
To copy to clipboard, switch view to plain text mode 

In my program, when the # of widgets within the innerWidget increases, the QDockWidget resizes probably, BUT when the # of widgets within the innerWidget decreases, the QDockWidget doesn't reduce its size probably so there are blanks on the . I have tried to called updateGeometry, update, resize etc ... but nothing helps.