Results 1 to 2 of 2

Thread: QDialog derived and focus problem

  1. #1
    Join Date
    Apr 2008
    Posts
    1

    Default QDialog derived and focus problem

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QDialog derived and focus problem

    Could you prepare a minimal compilable example reproducing the problem?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.