alitoh
28th April 2011, 15:59
I was wondering if it was possible to use same layout objects (a QHBoxLayout, i.e) to define the layout of different objects.
E.g.
QHBoxLayout * boxLayout;
QGridLayout * gridLayout;
QGroupBox * group1;
QGroupBox * group2;
QGroupBox * group3;
QComboBox * comboBox1;
QComboBox * comboBox2;
QComboBox * comboBox3;
QLabel * label1;
QLabel * label2;
QLabel * label3;
//-------------------
gridLayout->addWidget(label1);
gridLayout->addWidget(comboBox1);
groupBox->setLayout(gridLayout);
and then do somethingl ike gridLayout->clear(); and reuse that layout.
My problem is that I've found myself in need of nested layouts inside 3 GroupBoxes and it would be rather annoying to triple the ammount of objects (once for every GroupBox) just because of it.
Thanks for your help.
E.g.
QHBoxLayout * boxLayout;
QGridLayout * gridLayout;
QGroupBox * group1;
QGroupBox * group2;
QGroupBox * group3;
QComboBox * comboBox1;
QComboBox * comboBox2;
QComboBox * comboBox3;
QLabel * label1;
QLabel * label2;
QLabel * label3;
//-------------------
gridLayout->addWidget(label1);
gridLayout->addWidget(comboBox1);
groupBox->setLayout(gridLayout);
and then do somethingl ike gridLayout->clear(); and reuse that layout.
My problem is that I've found myself in need of nested layouts inside 3 GroupBoxes and it would be rather annoying to triple the ammount of objects (once for every GroupBox) just because of it.
Thanks for your help.