Results 1 to 2 of 2

Thread: Different behavior on Windows & OS X, when a QGraphicsItem is dragged out of QGraphic

  1. #1
    Join Date
    Feb 2012
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Different behavior on Windows & OS X, when a QGraphicsItem is dragged out of QGraphic

    I noticed that on Windows and Mac OS X 10.6, when dragging a QGraphicsItem out of the current QGraphicsView, but still in the QGraphicsScene, the code flow is not same. And I think there may be something wrong on OS X. In file "QGraphicsScene.cpp", there is a function:

    void QGraphicsScenePrivate::sendMouseEvent(QGraphicsSce neMouseEvent *mouseEvent)
    {
    if (mouseEvent->button() == 0 && mouseEvent->buttons() == 0 && lastMouseGrabberItemHasImplicitMouseGrab) {
    // ### This is a temporary fix for until we get proper mouse
    // grab events.
    clearMouseGrabber();
    return;
    }
    ...
    }

    Just set a breakpoint there, on Mac OS, the if condition is true, so sendMouseEvent will return, and following code for event handling won't be executed, that will make something wrong. I think function button() should return LeftButton, that is the button pressed before dragging, but NoButton is returned. If the QGraphicsItem not dragged out of the QGraphicsView, all things are right.

    I think maybe it's a Qt bug, who can tell me when the value for button is changed after the QGraphicsSceneMouseEvent is made (where is the related line in source code)? Thanks!

  2. #2
    Join Date
    Feb 2012
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Different behavior on Windows & OS X, when a QGraphicsItem is dragged out of QGra

    I have investigate into this issue, and I found following lines in function "qt_mac_handleMouseEvent", file "qt_cocoa_helpers_mac.mm" :

    Qt::MouseButtons buttons = 0;
    {
    UInt32 mac_buttons;
    if (GetEventParameter(carbonEvent, kEventParamMouseChord, typeUInt32, 0,
    sizeof(mac_buttons), 0, &mac_buttons) == noErr)
    buttons = qt_mac_get_buttons(mac_buttons);
    }

    When the QGraphicsItem is dragged out of the view and then dragged back, the value of mac_buttons is 0 (NoButton), however the LeftButton is keeping pressed. So I guess the here is the issue. But I don't know how to deal with it.

Similar Threads

  1. Weird behavior of QGraphicsItem mapFromScene
    By qlands in forum Qt Programming
    Replies: 2
    Last Post: 16th June 2013, 03:19
  2. Weird Deployment Behavior, Windows
    By skepticalgeek in forum Qt Programming
    Replies: 6
    Last Post: 6th October 2010, 08:51
  3. Replies: 1
    Last Post: 15th August 2009, 11:23
  4. QGraphicsItem tooltip behavior
    By darksaga in forum Qt Programming
    Replies: 6
    Last Post: 22nd August 2007, 17:50
  5. QListWidget selection behavior as in Windows XP
    By Levon Nikoghosyan in forum Qt Programming
    Replies: 1
    Last Post: 9th January 2007, 13:11

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.