void ContentWindowGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent * event) { // on Mac we've seen that mouse events can go to the wrong graphics item // this is due to the bug: https://bugreports.qt.nokia.com/browse/QTBUG-20493 // here we ignore the event if it shouldn't have been sent to us, which ensures // it will go to the correct item... if(boundingRect().contains(event->pos()) == false) { event->ignore(); return; } // button dimensions float buttonWidth, buttonHeight; getButtonDimensions(buttonWidth, buttonHeight); // item rectangle and event position QRectF r = boundingRect(); QPointF eventPos = event->pos(); // check to see if user clicked on the close button if(fabs((r.x()+r.width()) - eventPos.x()) <= buttonWidth && fabs(r.y() - eventPos.y()) <= buttonHeight) { close(); return; } // move to the front of the GUI display moveToFront(); ContentWindowManagerPtr contentWindow = getContentWindowManager(); if (!contentWindow) return; if (selected()) { contentWindow->getInteractionDelegate().mousePressEvent(event); return; } contentWindow->getContent()->blockAdvance( true ); // check to see if user clicked on the resize button if(fabs((r.x()+r.width()) - eventPos.x()) <= buttonWidth && fabs((r.y()+r.height()) - eventPos.y()) <= buttonHeight) { resizing_ = true; } // check to see if user clicked on the fullscreen button else if(fabs(r.x() - eventPos.x()) <= buttonWidth && fabs((r.y()+r.height()) - eventPos.y()) <= buttonHeight) { toggleFullscreen(); } else if(fabs(((r.x()+r.width())/2) - eventPos.x() - buttonWidth) <= buttonWidth && fabs((r.y()+r.height()) - eventPos.y()) <= buttonHeight && g_configuration->getOptions()->getShowMovieControls( )) { contentWindow->setControlState( ControlState(contentWindow->getControlState() ^ STATE_PAUSED) ); } else if(fabs(((r.x()+r.width())/2) - eventPos.x()) <= buttonWidth && fabs((r.y()+r.height()) - eventPos.y()) <= buttonHeight && g_configuration->getOptions()->getShowMovieControls( )) { contentWindow->setControlState( ControlState(contentWindow->getControlState() ^ STATE_LOOP) ); } else moving_ = true; QGraphicsItem::mousePressEvent(event); }