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

Qt6 QMouseEvent invisibly overwrite last event global position

    XMLWordPrintable

Details

    • All

    Description

      The QMouseEvent objects created in sequence overwrite the previously created QMouseEvent global coordinates. This is demonstrated by the following test program:

      #include <QGuiApplication>
      #include <QMouseEvent>
      #include <cstdio>
      
      int main( int argc, char* argv[] )
      {
          QGuiApplication app( argc, argv );
          
          QMouseEvent ev1( QEvent::MouseButtonPress, QPointF( 0.0, 0.0 ),
                           QPointF( 10.0, 10.0 ), Qt::LeftButton,
                           Qt::LeftButton, Qt::NoModifier );
          fprintf( stderr, "Event 1 at: %d x %d\n", ev1.globalX(), ev1.globalY() );
          QMouseEvent ev2( QEvent::MouseButtonPress, QPointF( 20.0, 20.0 ),
                           QPointF( 30.0, 30.0 ), Qt::LeftButton,
                           Qt::LeftButton, Qt::NoModifier );
          fprintf( stderr, "Event 1 at: %d x %d\n", ev1.globalX(), ev1.globalY() );
          return 0;
      }
      

      Expected output:

      Event 1 at: 10 x 10
      Event 1 at: 10 x 10
      

      Actual output:

      Event 1 at: 10 x 10
      Event 1 at: 30 x 30
      

      Attachments

        Issue Links

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

          Activity

            People

              vhilshei Volker Hilsheimer
              jarekk Jaroslaw Kubik
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change