PDA

View Full Version : QDialog derived and focus problem



elm66
4th April 2008, 21:45
Hi there,
there must be an obvious answer to my problem but I am a beginner with Qt so bare with me.
I have my own dialog class derived from QDialog using a layout provided by designer.
In this dialog, I have several QLineEdit widgets and an Ok/Cancel Button which is not part of a QDialogButtonBox. I want to be able to perform some calculations/checking when pressing the return key within a QLineEdit without closing the dialog. If I had used QDialogButtonBox, the OK button within would capture the signal and automatically close the dialog. That is the reason for which I am using my own Ok/Cancel Pushbutton with no default. Those buttons are respectively connected to the slots accept()/reject() which are overloaded. This seems to work.

This dialog is modal. Once my checkings are done and I click on the Ok button, the accept() slots is run. The dialog closes and it seems to get back into the main event loop of the application. Unfortunately, if I click on one of my application button, nothing happens. I need to click a second time to have it work properly. It is as if the focus was not returned to the application or the main event loop was not handling the signals anymore for one mouse clock. What is my mistake?

You may also have a better way to perform my checkings after pressing return within the QEditLine without closing the dialog.

I would appreciate any help.

Eric

wysota
4th April 2008, 21:52
Could you prepare a minimal compilable example reproducing the problem?