PDA

View Full Version : Retractable GUI Area



QT++
28th May 2013, 11:27
Good Evening,

First off I would like to apologise for my question. Typically I code command line C++ so the GUI is giving me a little trouble. I want to code a "collapsible" section within my GUI. Something like the collapsible sections on this website (vBulletin) on the forum home page.

The section is always there but only expands and moves everything else down the page when a button is triggered. If anyone needs a better explanation I will attach a jpg.

Want to know if this something pre-programmed for Qt or if it's a from scratch project. I am assuming there is some function I can just call to make this all very simple.

Thanks

wysota
28th May 2013, 11:54
http://www.qtcentre.org/wiki/index.php?title=Expanding_dialog

QT++
29th May 2013, 10:30
Thankyou for the reply, I have played around with it and seams a little bit of overkill for what I want.

Is there a way to make a custom widget or for example a lineEdit become visable or hidden in a few lines of simple code. Something like



void MainWindow::on_checkBox_clicked()
{
if (ui->checkBox->isChecked()){
// custom widget or lineedit visable
}
else{
// custom widget or lineedit invisable
}
}


Thankyou for your time.

rawfool
29th May 2013, 11:00
QWidget *customWidget = new QWidget(); // Assuming this as your custom widget or QLineEdit

void MainWindow::on_checkBox_clicked()
{
if (ui->checkBox->isChecked())
{
widget->show();
}
else
{
widget->hide();
}
}

wysota
29th May 2013, 11:08
Is there a way to make a custom widget or for example a lineEdit become visable or hidden in a few lines of simple code. Something like


connect(ui->checkBox, SIGNAL(toggled(bool)), customWidget, SLOT(setVisible(bool)));