How to disable double click when placing markups

When placing markups consistently (check the Place multiple control points button), if I double clicked then it will terminate the place process. How can I avoid it?

Why do you need to double-click? Just curious?

In fact I don’t need double-click but sometimes you may just do it accidentally, and that is how I find this problem.

There needs to be a function to stop the placement so that, for example you can reorient your object in 3D view to get the new ones. That’s normally the right-click. I never tried double-click before, but I can confirm that it does indeed stop the placement mode. I don’t know whether its intentional, so I included @smrolfe @lassoan.

As for re-activating the placement mode, whether you stopped accidentally or intentionally, can be done via a quick keyboard shortcut CTRL+SHIFT+SPACE. See the documentation for Markups keyboard shortcuts here

You can also define your own (provided that it does not conflict with already existing ones).

1 Like

Yes, in the Markups module documentation:

  1. Left-click in a slice view or 3D view to place points.
  2. Double-left-click or right-click to finish point placement.

Double-left-click is a thing as I believe it is a standard thing for ending for example a closed curve group of points.

1 Like

@muratmaga @jamesobutler Thanks for the reply.

Since it is designed intentionally, I decided not to deal with it and found another way to solve my problem.

The solution goes like:

qvtkConnect(interactionNode, vtkMRMLInteractionNode::EndPlacementEvent, this,

and in the slot function make a judgement when to reactive the placement mode.

void XXX::onEndPlacement()
  auto scene = qSlicerApplication::application()->mrmlScene();
  auto interactionNode = vtkMRMLInteractionNode::SafeDownCast(
  auto selectionNode = vtkMRMLSelectionNode::SafeDownCast(
  auto nodeID = selectionNode->GetActivePlaceNodeID();
  auto node = vtkMRMLMarkupsFiducialNode::SafeDownCast(scene->GetNodeByID(nodeID));
  if (Judgement about the MarkupsNode)
1 Like

Maybe it is a bit simpler if you customize the event mappings as shown in examples the script repository: [1] and [2]

For example, you can remove the double-click shortcut in the first 3D view like this:

threeDViewWidget =
markupsDisplayableManager = threeDViewWidget.threeDView().displayableManagerByClassName('vtkMRMLMarkupsDisplayableManager')
markupsDisplayNodes = slicer.util.getNodesByClass("vtkMRMLMarkupsDisplayNode")
for markupsDisplayNode in markupsDisplayNodes:
  markupsWidget = markupsDisplayableManager.GetWidget(markupsDisplayNode)
  markupsWidget.SetEventTranslation(markupsWidget.WidgetStateDefine, vtk.vtkCommand.LeftButtonDoubleClickEvent, vtk.vtkEvent.NoModifier, vtk.vtkWidgetEvent.NoEvent)

Similarly, you can remove double-click event processing in the camera widget to prevent double-click from maximizing/restoring the current view.

1 Like