olidem
25th February 2010, 20:53
Hi!
I have added a QGoupBox to my QVBoxLayout.
The QGroupBox itself also holds a QVBoxLayout.
QVBoxLayout * outer = new QVBoxLayout;
outer->addWidget(new QPushButton("A"));
outer->addWidget(new QPushButton("B"));
QGroupBox * box = new QGroupBox("title");
QVBoxLayout * inner = new QVBoxLayout;
inner->addWidget(new QRadioButton("Poss A"));
inner->addWidget(new QRadioButton("Poss B"));
box->setLayout(inner);
box->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Mi nimum); //doesn't help :-(
outer->addWidget(box);
outer->addWidget(new QPushButton("C"));
outer->addWidget(new QPushButton("D"));
In this example, the QPushButtons automatically have "unit" height, but are horizontally expanded to maximum width.
The GroupBox also expands to maximal height, which I do not want.
So, my concern is to find a way, s.t. the group box only takes as much space as it really needs to display its contents, i.e. the two QRadioButtons.
Thank you for your help in advance,
Best regards,
Oliver
I have added a QGoupBox to my QVBoxLayout.
The QGroupBox itself also holds a QVBoxLayout.
QVBoxLayout * outer = new QVBoxLayout;
outer->addWidget(new QPushButton("A"));
outer->addWidget(new QPushButton("B"));
QGroupBox * box = new QGroupBox("title");
QVBoxLayout * inner = new QVBoxLayout;
inner->addWidget(new QRadioButton("Poss A"));
inner->addWidget(new QRadioButton("Poss B"));
box->setLayout(inner);
box->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Mi nimum); //doesn't help :-(
outer->addWidget(box);
outer->addWidget(new QPushButton("C"));
outer->addWidget(new QPushButton("D"));
In this example, the QPushButtons automatically have "unit" height, but are horizontally expanded to maximum width.
The GroupBox also expands to maximal height, which I do not want.
So, my concern is to find a way, s.t. the group box only takes as much space as it really needs to display its contents, i.e. the two QRadioButtons.
Thank you for your help in advance,
Best regards,
Oliver