PDA

View Full Version : Shape-Changing Dialog



gtnoob
10th November 2012, 19:49
Hi
I was testing the Shape-Changing Dialog in the Jasmin Blanchette Qt4 book.
I tried to reproduce but the group box i hide never show up again.
Better than pasting the code here e will attach it.

Could someone take a look?

Thanks

Zlatomir
10th November 2012, 20:18
You hide a groupbox and the toogle signal you connect to your main dialog, so fix that:


connect(ui->toggleBtn, SIGNAL(toggled(bool)), this, SLOT(setVisible(bool))); //why you connect with "this" instead of what you hide? ui->groupBox1_2
//...
ui->groupBox1_2->hide(); //you hide groupBox1_2 but the connect will hide your whole dialog

gtnoob
10th November 2012, 21:30
Sorry ... my distraction after a couple of failed attempts.
How about this version ... still not getting it!?

Zlatomir
10th November 2012, 22:06
You didn't set the "More" button's checkable (http://doc.qt.digia.com/qt/qabstractbutton.html#checkable-prop) to true, use this in code:

ui->toggleBtn->setCheckable(true);
//or check is in Designer

gtnoob
11th November 2012, 09:20
Arghhh ... this easy :o
Thanks a lot.