PDA

View Full Version : Shape-resizing dialogs doesn't work...



nina1983
26th September 2008, 14:01
Dear,

I read the others post, I'm doing as is written in the book by Blanchette & Summerfield but it doesn't work!!!!!!!!!

I explain better the situation:
- I have a QDialog containing three GroupBox and three button. One GroupBox and two button are hidden (let's call them: "button1","button2" and "groupBox")
- when the third button is clicked the hidden widgets are displayed.
I attached here the GUI I have prepared with Qt Designer.

The problems are:
- if I do as written in the book:
connect(button, SIGNAL(toggled(bool)), groupBox, SLOT(setVisible(bool)));
connect(button, SIGNAL(toggled(bool)), button1 SLOT(setVisible(bool)));
connect(button, SIGNAL(toggled(bool)), button2, SLOT(setVisible(bool)));
nothing is displayed when I click the button that should display the hidden widgets. I solved this problem implementing my own slot that works as this:
groupBox->setVisible(!OverviewGroupBox->isVisible());
button1->setVisible(!OverviewGroupBox->isVisible());
button2->setVisible(!OverviewGroupBox->isVisible());

- the second problem is that when the Dialog is displayed for the first time (with the three widgets hidden) the size is not set at the minimum, I mean... there is lot of left space, here attached there is also a screeshot...

To conclude here the code of the constructor of the dialog.
{
setupUi(this);
button1->hide();
button2->hide();
groupBox->hide();

layout()->setSizeConstraint(QLayout::SetFixedSize);
connect(button, SIGNAL(clicked()), this, SLOT(myslot()));

}

I hope this is enough to understand the problem.
Thanks in advance

Annalisa

nina1983
30th September 2008, 17:17
no one has any idea???

I didn't solve the problem yet...

could be something related with layouts?

Thanks

Annalisa

spirit
30th September 2008, 17:21
what do you want to get, extension dialog?

nina1983
1st October 2008, 08:24
I'm just looking for a dialog that reshape correctly when some of its widgets are not displayed... not like in the attachment above where lot of space at the bottom of the dialog is left empty...

Thanks

Annalisa

spirit
1st October 2008, 08:27
you should set setSizeConstraint(QLayout::SetFixedSize) for top-level layout.
see an example in QTDIR/examples/dialogs/extension/