Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-31845

Closing using the 'X" in the top right corner of Modal QDialogs opened by double clicking on a QToolButton stop mouse events from going to the QMainWindow



    • Commits:


      When a modal QDialog is opened by double clicking on a QToolButton and then closed by using the 'X' close button in the top right corner, or closed without clicking into the QDialog, will stop MouseEvents from going to the CentralWidget of the QMainWindow that is the parent to the QDialog. This leaves the application in a weird state where double clicking on other buttons do not work as they should.

      • The included example shows a application with a toolbar with two buttons and a centralWidget that is a label. The Label shows the mouse events and the location of the mouse if it is a mouse move event. If you double click the "double click" button then it opens a QDialog and if you close it with the 'X' then the label will stop to display the mouse move events until you click into it. If you single click on the "Single Click" button then it will open a dialog and if you close it with the 'X' then you still get mouse move events and everything is fine. This shows the difference between single and double clicked opened QDialogs closed the same way.

      The dialog will always say what type of clicked opened it, double or single.

      Double clicking on the "Single Click" button will always fire a single click QDialog before it can fire a double click dialog. But if you double click on the "Double Click" button and then close with the 'X' button then if you double click on the "Single Click" button it will not fire the single click dialog but instead the double click dialog. This shows one of the ways the buttons get in a weird state.

      For these examples to work you must not click anywhere inside the QDialog when it opens and only click the 'X' to close it. For some reason clicking inside the dialog before closing it seems to not cause this issue. I have found in user testing that user often open a dialog (using double click) and then close it without clicking into the dialog and then they get into this bad state.


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            Unassigned Unassigned
            mbarrie Matthew Barrie
            0 Vote for this issue
            6 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes