mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 06:27:26 -06:00
Select the object underneath the cursor on context menu request
Contributes to CURA-3609
This commit is contained in:
parent
05e1de2fb3
commit
3d5e535b69
1 changed files with 8 additions and 0 deletions
|
@ -219,6 +219,7 @@ class CuraApplication(QtApplication):
|
|||
|
||||
self.getController().getScene().sceneChanged.connect(self.updatePlatformActivity)
|
||||
self.getController().toolOperationStopped.connect(self._onToolOperationStopped)
|
||||
self.getController().contextMenuRequested.connect(self._onContextMenuRequested)
|
||||
|
||||
Resources.addType(self.ResourceTypes.QmlFiles, "qml")
|
||||
Resources.addType(self.ResourceTypes.Firmware, "firmware")
|
||||
|
@ -1332,3 +1333,10 @@ class CuraApplication(QtApplication):
|
|||
except Exception as e:
|
||||
Logger.log("e", "Could not check file %s: %s", file_url, e)
|
||||
return False
|
||||
|
||||
def _onContextMenuRequested(self, x, y):
|
||||
# Ensure we select the object if we request a context menu over an object without having a selection.
|
||||
if not Selection.hasSelection():
|
||||
node = self.getController().getScene().findObject(self.getRenderer().getRenderPass("selection").getIdAtPosition(x, y))
|
||||
if node:
|
||||
Selection.add(node)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue