PDA

View Full Version : One Widget on top of Another Problem



sujan.dasmahapatra
11th May 2010, 13:46
Dear Friends
One Widget is on top of snother, when a radio button is checked first should pop up, and when the second radio button is checked the second widget should pop up...I have tried using show(), hide() slots.. but it didnt work. Any idea would be highly appreciated. See the code snippet below.
Using Qt- designer I have placed two widgets on of one another.

QTextEdit edit1, edit2;

if(radio_1->isChecked()==true) {
edit2->hide();
edit1->show();
}
else {
edit1->hide();
edit2->show()
}

qlands
11th May 2010, 14:31
Ty by connecting onCheckBoxClicked(bool checked) signal to a slot to control the setVisible. Something like:



connect(ui->checkBox,SIGNAL(clicked(bool)),this,SLOT(on_checkB ox_clicked(bool)))

void MainWindow::on_checkBox_clicked(bool checked)
{
ui->textEdit->setVisible(checked);
ui->textEdit_2->setVisible(!checked);
}