ttvo
10th June 2009, 20:58
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
QGridLayout *gridLayout = new QGridLayout(this);
gridLayout->setSpacing(5);
gridLayout->setMargin(2);
gridLayout->addWidget(innerWidget, 0, 0, 1, 3);
gridLayout->addWidget(ui.line, 1, 0, 1, 3);
gridLayout->addWidget(ui.runBtn, 2, 1, 1, 1);
innerWidget QWidget also has a QGridLayout that takes in an integer of how many row QLineEdit and QLabel to create
QGridLayout *mainLayout = new QGridLayout(this);
mainLayout->setSpacing(5);
mainLayout->setMargin(2);
for (int i=0; i<nParams; ++i)
{
int col = 0;
QLabel* label = new QLabel("test");
QLineEdit* lineEdit = new QLineEdit();
mainLayout->addWidget(label, i, col++);
mainLayout->addWidget(lineEdit, i, col++);
}
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.
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
QGridLayout *gridLayout = new QGridLayout(this);
gridLayout->setSpacing(5);
gridLayout->setMargin(2);
gridLayout->addWidget(innerWidget, 0, 0, 1, 3);
gridLayout->addWidget(ui.line, 1, 0, 1, 3);
gridLayout->addWidget(ui.runBtn, 2, 1, 1, 1);
innerWidget QWidget also has a QGridLayout that takes in an integer of how many row QLineEdit and QLabel to create
QGridLayout *mainLayout = new QGridLayout(this);
mainLayout->setSpacing(5);
mainLayout->setMargin(2);
for (int i=0; i<nParams; ++i)
{
int col = 0;
QLabel* label = new QLabel("test");
QLineEdit* lineEdit = new QLineEdit();
mainLayout->addWidget(label, i, col++);
mainLayout->addWidget(lineEdit, i, col++);
}
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.