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

Event behavior for QEvent::MouseButtonDblClick changed since Qt 4

    XMLWordPrintable

Details

    • 9063edef796ad10eb9ac2229627f36d60168f0e2, Menu regression fix-up: 828cfb4019939a39c84e5c5e17dc8cb52e9f63fd (stable, 3.4.2014, 5.3)

    Description

      There's a slight difference in event handling between Qt 4 and 5 when receiving mouse double clicks:

      4.8.6 
      #0 MouseButtonPress    widget QWidget(0xd4caa0, name = "Widget") 
      #1 MouseButtonRelease  widget QWidget(0xd4caa0, name = "Widget") 
      #2 MouseButtonDblClick widget QWidget(0xd4caa0, name = "Widget") 
      #3 MouseButtonRelease  widget QWidget(0xd4caa0, name = "Widget") 
      
      5.2.1 
      #0 MouseButtonPress    window QWidgetWindow(0x1bd4f80, name = "WidgetWindow") 
      #0 MouseButtonPress    widget QWidget(0x1bd47f0, name = "Widget") 
      #1 MouseButtonRelease  window QWidgetWindow(0x1bd4f80, name = "WidgetWindow") 
      #1 MouseButtonRelease  widget QWidget(0x1bd47f0, name = "Widget") 
      #2 MouseButtonPress    window QWidgetWindow(0x1bd4f80, name = "WidgetWindow") 
      #2 MouseButtonPress    widget QWidget(0x1bd47f0, name = "Widget") 
      #3 MouseButtonDblClick window QWidgetWindow(0x1bd4f80, name = "WidgetWindow") 
      #3 MouseButtonDblClick widget QWidget(0x1bd47f0, name = "Widget") 
      #4 MouseButtonRelease  window QWidgetWindow(0x1bd4f80, name = "WidgetWindow") 
      #4 MouseButtonRelease  widget QWidget(0x1bd47f0, name = "Widget") 
      
      5.3.1 (with fix applied)
      #0 MouseButtonPress    window flags:0 src:0 QWidgetWindow(0xab9bf0, name = "WidgetWindow")
      #0 MouseButtonPress    widget flags:0 src:0 QWidget(0xab68c0, name = "Widget")
      #1 MouseButtonRelease  window flags:0 src:0 QWidgetWindow(0xab9bf0, name = "WidgetWindow")
      #1 MouseButtonRelease  widget flags:0 src:0 QWidget(0xab68c0, name = "Widget")
      #2 MouseButtonPress    window flags:1 src:0 QWidgetWindow(0xab9bf0, name = "WidgetWindow")
      #3 MouseButtonDblClick window flags:0 src:0 QWidgetWindow(0xab9bf0, name = "WidgetWindow")
      #2 MouseButtonDblClick widget flags:0 src:0 QWidget(0xab68c0, name = "Widget")
      #4 MouseButtonRelease  window flags:0 src:0 QWidgetWindow(0xab9bf0, name = "WidgetWindow")
      #3 MouseButtonRelease  widget flags:0 src:0 QWidget(0xab68c0, name = "Widget")
      

      I'd just like to clarify if this change is intended for Qt 5, I can clearly see the logic of sending all three events for the last click.

      Minimal example code to produce the above output of event names:

      #include <qapplication.h>
      #include <qevent.h>
      #include <qwidget.h>
      
      class EventDumper: public QWidget {
      public:
          EventDumper(): QWidget( 0 ) {}
      
          virtual bool event( QEvent *ev ) {
              const QEvent::Type et = ev->type();
              switch ( et ) {
                  case QEvent::MouseButtonDblClick:
                      qDebug("MouseButtonDblClick");
                      return true;
                  case QEvent::MouseButtonPress:
                      qDebug("MouseButtonPress");
                      return true;
                  case QEvent::MouseButtonRelease:
                      qDebug("MouseButtonRelease");
                      return true;
                  default:
                      break;
              }
              return QWidget::event( ev );
          }
      };
      
      int main( int argc, char **argv )
      {
          QApplication app( argc, argv );
          EventDumper ed;
          ed.show();
          return app.exec();
      }
      

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-25831
          # Subject Branch Project Status CR V

          Activity

            People

              rickst29 Richard Stockton
              metz Stefan Gehn (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes