Results 1 to 3 of 3

Thread: Modal QDialog events 'stall' until window is moved

  1. #1
    Join Date
    May 2017
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Modal QDialog events 'stall' until window is moved

    I'm using Qt 5.6.1 on Windows. I'm using it in a VST plugin. The host calls me, passing an HWND, and I use qtwinmigrate to turn that into a QWinWidget. I then stick my UI into that window by setting it as its parent...
    Qt Code:
    1. mWidget = new QWinWidget(static_cast<HWND>(ptr));
    2.  
    3. mEditor->setParent(mWidget);
    4. mEditor->move(0, 0);
    5. mEditor->show();
    6.  
    7. mWidget->move(0, 0);
    8. mWidget->show();
    To copy to clipboard, switch view to plain text mode 

    This has been working fine for years. Still works. But, something strange has happened since upgrading to Qt 5.6.

    One of the buttons in my Qt ui opens a modal dialog box. There is nothing special about this dialog box... a few text fields, a few check boxes, and obviously (given that it is modal) it has OK and Cancel buttons.

    The issue is this... that modal dialog box does not respond to any events. Click on an edit field to give it the focus, click on a checkbox, nothing. Even click the window close button at the top right corner of the window... nothing.

    BUT... Click in the window drag bar and like magic... all of those messages get processed. Like they are all queued up someplace.

    So, for example, if I click in an edit field, press the backspace key twice, and then click a blank checkbox, I see nothing change. But if I click in the window's drag bar... poof... I see the new value in the edit field and the new value in the checkbox.

    If I click the OK button... nothing... but if I then drag the window it closes out from under me and my code picks right up after the call to the dialog box's exec call. As if I had just pressed the OK button.

    Anyone have any ideas?

    Oh... and again... all of this same code worked fine prior to our update from 4.8 to 5.6.1

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Modal QDialog events 'stall' until window is moved

    Oh... and again... all of this same code worked fine prior to our update from 4.8 to 5.6.1
    Could be a Qt bug if you code didn't change.

    Is there a reason you are bound to 5.6.1 and can't try a newer version?
    (If it is a Qt bug, it might have been resolved since then)
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    May 2017
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Modal QDialog events 'stall' until window is moved

    OK. I fixed the issue. It may point to a Qt bug, or a documentation issue.

    Again, in my situation I am hosting a QWidget in a VST plugin... so the host is NOT Qt. My system needs to be "polled" often to do various things. We handle this by creating a simple little class we call Poller, which is derived from QObject. The Poller, in its constructor, starts a timer. In the timer callback we call our system poll functions. In our DllMain function, we instantiate one of these Pollers.

    OK... so... we have always started the timer with an argument of 0. The docs say...

    A timer event will occur every interval milliseconds until killTimer() is called. If interval is 0, then the timer event occurs once every time there are no more window system events to process.
    Again this always worked in the past.

    So now that we are using 5.6, setting the timer to 0 gives the bad behavior described above, but setting it to 1 makes everything work again.

Similar Threads

  1. Modal dialog only modal to base window?
    By SvenA in forum Qt Programming
    Replies: 3
    Last Post: 10th April 2015, 09:25
  2. Focus or update problem in modal QDialog
    By AlHadr in forum Qt Programming
    Replies: 1
    Last Post: 19th January 2010, 21:32
  3. Modal QDialog inside QMdiArea
    By Nesbitt in forum Qt Programming
    Replies: 1
    Last Post: 17th March 2009, 09:21
  4. QMainWindow modal from non-qt window?
    By hickscorp in forum Qt Programming
    Replies: 3
    Last Post: 21st November 2008, 09:10
  5. QDialog::exec() cereates no modal dialog
    By sboesch in forum Qt Programming
    Replies: 8
    Last Post: 27th March 2006, 17:03

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.