ruler and triangle were no longer receiving mouse move events

preferencesAboutTextFull
Clément Fauconnier 3 years ago
parent 6504c42e75
commit 002a5fefc6
  1. 29
      src/board/UBBoardView.cpp
  2. 1
      src/tools/UBGraphicsAxes.cpp
  3. 6
      src/tools/UBGraphicsRuler.cpp

@ -1243,6 +1243,35 @@ void UBBoardView::mouseMoveEvent (QMouseEvent *event)
if (!mTabletStylusIsPressed && scene()) { if (!mTabletStylusIsPressed && scene()) {
scene()->inputDeviceMove(mapToScene(UBGeometryUtils::pointConstrainedInRect(event->pos(), rect())) , mMouseButtonIsPressed); scene()->inputDeviceMove(mapToScene(UBGeometryUtils::pointConstrainedInRect(event->pos(), rect())) , mMouseButtonIsPressed);
} }
if (UBDrawingController::drawingController()->isDrawingTool())
{
QGraphicsItem* item = scene()->itemAt(mapToScene(event->pos()), QTransform());
if (item)
{
//if showMarkerPreviewCircle, showPenPreviewCircle or showEraserPreviewCircle is true, then the topmost visible item under the mouse is the preview circle
QGraphicsEllipseItem* circle = dynamic_cast<QGraphicsEllipseItem*>(scene()->itemAt(mapToScene(event->pos()), QTransform()));
if (circle)
{
circle->setVisible(false);
item = scene()->itemAt(mapToScene(event->pos()), QTransform());
if (item)
{
if (item->type() == UBGraphicsRuler::Type || item->type() == UBGraphicsTriangle::Type)
{
QGraphicsView::mouseMoveEvent(event);
}
}
circle->setVisible(true);
}
else
{
if (item->type() == UBGraphicsRuler::Type || item->type() == UBGraphicsTriangle::Type)
{
QGraphicsView::mouseMoveEvent(event);
}
}
}
}
event->accept (); event->accept ();
} }

@ -428,7 +428,6 @@ void UBGraphicsAxes::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
setCursor(Qt::ArrowCursor); setCursor(Qt::ArrowCursor);
mCloseSvgItem->setVisible(mShowButtons); mCloseSvgItem->setVisible(mShowButtons);
mNumbersSvgItem->setVisible(mShowButtons); mNumbersSvgItem->setVisible(mShowButtons);
UBDrawingController::drawingController()->mActiveRuler = NULL;
event->accept(); event->accept();
update(); update();
} }

@ -420,6 +420,9 @@ void UBGraphicsRuler::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{ {
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool (); UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool ();
if (UBDrawingController::drawingController()->mActiveRuler == nullptr)
UBDrawingController::drawingController()->mActiveRuler = this;
if (currentTool == UBStylusTool::Selector || if (currentTool == UBStylusTool::Selector ||
currentTool == UBStylusTool::Play) currentTool == UBStylusTool::Play)
{ {
@ -450,7 +453,6 @@ void UBGraphicsRuler::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
else if (UBDrawingController::drawingController()->isDrawingTool()) else if (UBDrawingController::drawingController()->isDrawingTool())
{ {
setCursor(drawRulerLineCursor()); setCursor(drawRulerLineCursor());
UBDrawingController::drawingController()->mActiveRuler = this;
event->accept(); event->accept();
} }
} }
@ -462,7 +464,7 @@ void UBGraphicsRuler::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
mCloseSvgItem->setVisible(mShowButtons); mCloseSvgItem->setVisible(mShowButtons);
mResizeSvgItem->setVisible(mShowButtons); mResizeSvgItem->setVisible(mShowButtons);
mRotateSvgItem->setVisible(mShowButtons); mRotateSvgItem->setVisible(mShowButtons);
UBDrawingController::drawingController()->mActiveRuler = NULL; UBDrawingController::drawingController()->mActiveRuler = nullptr;
event->accept(); event->accept();
update(); update();
} }

Loading…
Cancel
Save