Qt PushButton exec widgets
I have a checkable pushbutton set to exec/close a dialog widget that I
have created.
My idea is when the pushbutton is checked, it will close the dialog
widget. If it's not checked, it should open the dialog widget. But I am
unable to get it to work. It keeps on opening instances of the dialog
widget. I wanted to open one instance of the dialog widget only. Could
anyone please help?
MainDlg::MainDlg()
{
connect(dialogButton, SIGNAL(clicked()), this, SLOT(setDialog()));
}
void MainDlg::setDialog()
{
SetDialogDlg setDlg;
if(dialogButton->isChecked())
{
setDlg.close();
}
else
{
setDlg.exec();
}
}
No comments:
Post a Comment