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

Creating a new QMouseEvent can change globalPosition() in other QMouseEvents

    XMLWordPrintable

Details

    • Linux/Wayland

    Description

          QMouseEvent e(QEvent::MouseButtonPress, QPointF(10, 10), QPointF(40, 50), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
          Q_ASSERT(e.globalPosition() == QPointF(40, 50));
      
          QMouseEvent ee(e.type(), QPointF(10, 10), e.pos(), e.button(), e.buttons(), e.modifiers());
          Q_ASSERT(e.globalPosition() == QPointF(40, 50)); 

      The following code doesn't work as expected. The global position in "e" changes after creating "ee".

      I've attached a demo app that demonstrates the issue. The expected behavior is that the global position in the first mouse event remains unchanged after creating the second event.

      Attachments

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

        Activity

          People

            srutledg Shawn Rutledge
            zzag Vlad Zahorodnii
            Votes:
            4 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes