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

QStateMachine on QGraphicsView failed to handle QMouseEventTransition if the type is mouse release

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: P3: Somewhat important P3: Somewhat important
    • Some future release
    • 4.6.0
    • Widgets: GraphicsView
    • None
    • Windows 7 32bit

      Steps to Recreate:

      1) Have 2 states s1 and s2
      2) Set transition from s1 to s2 using mouse release message on QGraphicsView as follows
      QMouseEventTransition* tMouse = new QMouseEventTransition( m_ui->graphicsView, QEvent::MouseButtonRelease, Qt::LeftButton, s1);
      tMouse->setTargetState( s2);

      Result: s2 will never be entered. If you use mouse "press" message, it works well.

      I stepped into the code and found that in QGraphicsView::mousePressEvent, after spontaneous of event, you have the code:
      // Update the original mouse event accepted state.
      bool isAccepted = mouseEvent.isAccepted();
      event->setAccepted(isAccepted);
      "isAccepted" is false here and the message can be passed to State Machine.
      But in mouseReleaseEvent, the original mouse event accepted state is not updated and the State Machine will never get the chance to handle the mouse release event.

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

            laknoll Lars Knoll
            aladdina Mason Chang
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes