I use the statement: facility_placement_tool = FacilityPlacementTool(iface.mapCanvas(), vlayer_crs) iface.mapCanvas().setMapTool(facility_placement_tool)
to set a custom tool on the map canvas. It allows me to move a feature layer around the map canvas using the translateFeature method of the layer using the canvasMoveEvent of FacilityPlacementTool until I click on the left mouse button. Once the user clicks the left mouse, I detect that event and I run a method, rotateFeature, below that allows me to use the native QGIS rotate method. I can then rotate the feature. Expecting this to happen, it then seems that the rotate tool takes over the map canvas events from my FacilityPlacementTool so when I right click to end the rotate on the feature that's all that happens. But I want the right click to end editing which have in the canvasPressEvent method in FacilityPlacementTool. Is there a way after the code below runs and the user ends the rotate tool by right clicking that right click even can then be passed onto the FacilityPlacementTool tool or I can just run some other method that closes out the edit session. Also wondering why I have to get to the rotate feature tool with the code below, but there is a iface.actionMoveFeature().trigger() statement I can call to move a feature Why isn't there a iface.actionRotateFeature().trigger() method. def rotateFeature(self): # Get all actions actions = iface.mainWindow().findChildren(QAction) # Check the action action = [x for x in actions if x.objectName()=='mActionRotateFeature'][0] # Run the action action.trigger()
_______________________________________________ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer