Block tree context menu in blank area

This commit is contained in:
Veronica Berglyd Olsen
2025-01-22 00:58:55 +01:00
parent 7e42d04e36
commit 306bd245fc
+3 -8
View File
@@ -955,12 +955,9 @@ class GuiProjectTree(QTreeView):
if model := self._getModel(): if model := self._getModel():
if point is None: if point is None:
point = self.visualRect(self.currentIndex()).center() point = self.visualRect(self.currentIndex()).center()
if point is not None:
if ( index = self.indexAt(point)
point is not None if (node := self._getNode(index)) and (indices := self._selectedRows()):
and (node := self._getNode(self.currentIndex()))
and (indices := self._selectedRows())
):
ctxMenu = _TreeContextMenu(self, model, node, indices) ctxMenu = _TreeContextMenu(self, model, node, indices)
if node is SHARED.project.tree.trash: if node is SHARED.project.tree.trash:
ctxMenu.buildTrashMenu() ctxMenu.buildTrashMenu()
@@ -968,10 +965,8 @@ class GuiProjectTree(QTreeView):
ctxMenu.buildMultiSelectMenu() ctxMenu.buildMultiSelectMenu()
else: else:
ctxMenu.buildSingleSelectMenu() ctxMenu.buildSingleSelectMenu()
ctxMenu.exec(self.viewport().mapToGlobal(point)) ctxMenu.exec(self.viewport().mapToGlobal(point))
ctxMenu.setParent(None) ctxMenu.setParent(None)
return return
## ##