PDA

View Full Version : [SOLVED] How to close a dialog window (it's a little too modal)



Morea
1st February 2009, 12:17
Hi.
I'm using the Qt designer to create a dialog. I've added two buttons by hand, one Ok and one Cancel button.
with the signal slot editor I've connected the cancel buttons clicked() signal to the reject() slot of the dialog.
Clicking on the button when running the dialog has no effect. Not even clicking the windows "x" button in the window bar will close the window.

I show the dialog with a call

myDialog* dialog = new myDialog();
dialog->exec();

so what have I've done wrong?
The dialog is set to ApplicationModal.
(In the designer there is another modal button that can be checked in the propertyeditor for the QDialog)


Btw. what has happend to the qt-interest mailinglist?

rexi
1st February 2009, 13:11
That's really odd behaviour. My first guess was that something went wrong when connecting the "clicked()" signal, but it's strange that even the window's close button shows no effect. Are you tampering with window flags in your dialog? Maybe you could post the code in question, it will probably help to find the source of the problem.

Morea
1st February 2009, 13:18
Well... I'll be damned...
It seems that I implemented a function called done(int) and that was not very clever...

Now it works. I don't know exactly why, but I'll never write a done(int) function again.

jpn
1st February 2009, 15:49
I don't know exactly why, but I'll never write a done(int) function again.
QDialog::done(int) happens to be virtual... :)