editingFinished opening a modal dialog hides/blocks mouseUp events for the new focus target, but still runs the mouseDown.



  • Hello,

    What happens is that when I have a spinbox (lets call it A), with an autoconnected editingFinished signal. The editingFinished gets called properly, and inside it I show a dialog with QMessageBox::question. So far all is good. However if I cause the editingFinished by for example pressing down on the up button of a different spinbox (lets call it B), then once the modal dialog has closed, B will continuously increment the value as it believes it's being held down.
    How do I get rid of this behavior? Or work around it? This applies to more then only spinboxes, however with those it's the most noticeable. By clicking on a Button to cause editingFinished, the button will look as if it has no mouse interaction while the dialog is open. However as soon as the dialog is closed, the button gets "stuck" in a mouse down "look".

    I think this is a bug, but as it seems to have existed for a long time, it might not be? (I did find this: https://blogs.msdn.microsoft.com/gpalem/2012/03/03/dealing-with-qt-out-of-order-focusoutevent-bug/ )
    According to a semi-old post: https://forum.qt.io/topic/3247/signal-slot-question/13 it was possible to get past this by setting the other widgets focus policies to StrongFocus. However this did NOT work for me.
    Also, there is a difference between what is happening to me, and the behaviour I can find reports on. It looks like I only get the mouseDown event, and not a "clicked" event.

    Help would be very much appriciated!


  • Lifetime Qt Champion

    Hi,

    I'd try with a custom QDialog and use the open method.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.