PDA

View Full Version : dialog connection



maartenS
5th September 2008, 21:23
Hi

I'm trying to connect two dialogs by clicking a button on the first dialog.
For both dialogs I created slots in mainwindow.cpp. I would like to do something like:


void MainWindow::userDialogExec()
{
if (userDialog_p->exec()) {
mainInputWidget_p->updateForm();
}
}

void MainWindow::profileDialogExec()
{
if (profileDialog_p->exec()) {
connect (profileDialog_p->addButton, SIGNAL(clicked()), this, SLOT(userDialogExec()));
}
}

but profileDialog_p has no member named addButton. I made this form with designer so I should do probably something like profileDialog_p->ui.addButton, but that doesn't work since ui is private and I want to keep it private.

Any ideas?

thanks in andvance,

jacek
5th September 2008, 23:37
profileDialog_p has no member named addButton. I made this form with designer so I should do probably something like profileDialog_p->ui.addButton, but that doesn't work since ui is private and I want to keep it private.
Make profileDialog emit a signal.



if (profileDialog_p->exec()) {
connect (profileDialog_p->addButton, SIGNAL(clicked()), this, SLOT(userDialogExec()));
}
QDialog::exec() opens a modal dialog and returns after the dialog was closed, so your connection will be created after user accepts the dialog. Are you sure that's what you want?

maartenS
9th September 2008, 10:34
Make profileDialog emit a signal.

QDialog::exec() opens a modal dialog and returns after the dialog was closed, so your connection will be created after user accepts the dialog. Are you sure that's what you want?

Hi, thanks for your reply. It didn't work because of my misunderstanding of modal en modeless dialogs. Now I did a profileDialog_p->show and now i can receive signals from the buttons in the dialog.

Thanks for your help!