[Solved] Display QgroupBox on main window.
-
Hi,
I would like to create and display a QgroupBox on my main window.
So far I do that:
@ QGroupBox *groupB=new QGroupBox();
QVBoxLayout *vbox = new QVBoxLayout();
int n=3;
QPushButton *button[n];
for(int i=1;i<=n;i++)
{
button[i]=new QPushButton();
button[i]->setText(i);
vbox->addWidget(button[i]);
}
groupB->setLayout(vbox);
groupB->show();@The group of boxes is created and display but on a "pop up" window.
How should I proceed to change this?Thanks
-
Hi,
You can call
@setCentralWidget(groupB);@
-
And remove
@groupB->show();@
If main function calls show() for main window. -
Ahhhhh I remember reading that somewhere. It works perfectly.
Thanks -
And if I want to hide it again?
-
@groupB->hide();@
-
could not have been more straightforward!
Thanks