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

Starting Drag'n'Drop in QGraphicsScene::mouseMoveEvent() breaks move-functionality of QGraphicsItems

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 4.8.0, 5.1.0 , 5.2.0 Alpha
    • None
    • Tested on Arch Linux and MacOSX using Qt 5.1.0 and 4.8.0, 5.2.0 alpha on windows 7

    Description

      Calling QDrag::exec() from within QGraphicsScene::mouseMoveEvent() leads to the following problem:
      Although dragging and dropping the items works correctly, after dropping the items they cannot be moved normally anymore, but they jump to a new position.

      Detailed description:
      The problem arises when the drag start-position is different from the mouse-down position, as it is when you use a minimal drag distance etc.

      Attached Example:
      I attached a small example application which shows the problem. Click on one of the two items, move it quite a bit, and then press CTRL (which starts the drag operation). When you then drop the item and click it to move it again, it will jump to the position where it was before the first drag operation.

      My guess why this problem exists:
      I found out that normally QDrag::exec() calls processEvents internally, so that events like mouseReleaseEvent() should still be received by the QGraphicsScene. But in my example, this event is not received.
      This might be problematic, because QGraphicsScene::mousePressEvent() was called, but not the corresponding QGraphicsScene::mouseReleaseEvent(). I guess that this leads to an invalid internal state in QGraphicsScene, which causes the problem.

      Attachments

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

        Activity

          People

            andrhans Andreas Aardal Hanssen
            bingo2 Ingo Budde
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes