Allow Ctrl+Del to be propagated to the document editor

This commit is contained in:
Veronica K. B. Olsen
2021-02-11 19:11:41 +01:00
parent 3a60abaeee
commit 08651685d4
3 changed files with 17 additions and 3 deletions
+11 -1
View File
@@ -172,6 +172,16 @@ class GuiMainMenu(QMenuBar):
QDesktopServices.openUrl(QUrl(theUrl))
return True
def _handleCtrlDel(self):
"""Direct the Ctrl+Del key press to the correct widget.
"""
if self.theParent.treeView.hasFocus():
self.theParent.treeView.deleteItem(None)
elif self.theParent.docEditor.hasFocus():
self.theParent.docEditor.docAction(nwDocAction.DEL_WORD)
return
##
# Menu Builders
##
@@ -270,7 +280,7 @@ class GuiMainMenu(QMenuBar):
self.aDeleteItem = QAction("Delete Item", self)
self.aDeleteItem.setStatusTip("Delete selected project item")
self.aDeleteItem.setShortcut("Ctrl+Del")
self.aDeleteItem.triggered.connect(lambda: self.theParent.treeView.deleteItem(None))
self.aDeleteItem.triggered.connect(self._handleCtrlDel)
self.projMenu.addAction(self.aDeleteItem)
# Project > Move Up