Skip to content

Commit

Permalink
BUG: Fix interaction bug with laser pointer
Browse files Browse the repository at this point in the history
Without this fix, although the first button press worked on any child widget of the set GUI widget, after this first click, no other button reacted to the interaction. Now all the buttons in the GUI widget work as expected.

Re KitwareMedical#43
  • Loading branch information
cpinter committed Aug 22, 2023
1 parent 84b633d commit 3e16903
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions GUIWidgets/qSlicerGUIWidgetsModuleWidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void qSlicerGUIWidgetsModuleWidget::onStartInteractionButtonClicked()
}
else
{
//std::cout << "No intersection was found... \n";
//std::cout << "No intersection was found \n";
return;
}

Expand Down Expand Up @@ -386,13 +386,11 @@ void qSlicerGUIWidgetsModuleWidget::onStartInteractionButtonClicked()
QGraphicsSceneMouseEvent pressEvent(QEvent::GraphicsSceneMousePress);
pressEvent.setScenePos(QPointF(xPositionPixels, yPositionPixels));
pressEvent.setButton(Qt::LeftButton);
pressEvent.setButtons(Qt::LeftButton);
QApplication::sendEvent(texture->GetScene(), &pressEvent);

// Send release event
QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease);
releaseEvent.setScenePos(QPointF(xPositionPixels, yPositionPixels));
releaseEvent.setButton(Qt::LeftButton);
releaseEvent.setButtons(Qt::LeftButton);
QApplication::sendEvent(texture->GetScene(), &releaseEvent);
}

0 comments on commit 3e16903

Please sign in to comment.