Drop deleteLater for context menus

This commit is contained in:
Veronica Berglyd Olsen
2025-01-22 00:53:18 +01:00
parent 53dfdb3a2e
commit 7e42d04e36
6 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -1217,7 +1217,7 @@ class GuiDocEditor(QPlainTextEdit):
# Execute the context menu
ctxMenu.exec(self.viewport().mapToGlobal(pos))
ctxMenu.deleteLater()
ctxMenu.setParent(None)
return
+1 -1
View File
@@ -424,7 +424,7 @@ class GuiDocViewer(QTextBrowser):
# Open the context menu
ctxMenu.exec(self.viewport().mapToGlobal(point))
ctxMenu.deleteLater()
ctxMenu.setParent(None)
return
+1 -1
View File
@@ -970,7 +970,7 @@ class GuiProjectTree(QTreeView):
ctxMenu.buildSingleSelectMenu()
ctxMenu.exec(self.viewport().mapToGlobal(point))
ctxMenu.deleteLater()
ctxMenu.setParent(None)
return
+1 -1
View File
@@ -376,7 +376,7 @@ class _OpenProjectPage(QWidget):
action = ctxMenu.addAction(self.tr("Remove Project"))
action.triggered.connect(self._deleteSelectedItem)
ctxMenu.exec(self.mapToGlobal(pos))
ctxMenu.deleteLater()
ctxMenu.setParent(None)
return
##
+2
View File
@@ -332,6 +332,7 @@ def testGuiEditor_MetaData(qtbot, nwGUI, projPath, mockRnd):
def testGuiEditor_ContextMenu(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
"""Test the editor context menu."""
monkeypatch.setattr(QMenu, "exec", lambda *a: None)
monkeypatch.setattr(QMenu, "setParent", lambda *a: None)
buildTestProject(nwGUI, projPath)
assert nwGUI.openDocument(C.hSceneDoc) is True
@@ -471,6 +472,7 @@ def testGuiEditor_ContextMenu(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
def testGuiEditor_SpellChecking(qtbot, monkeypatch, nwGUI, projPath, ipsumText, mockRnd):
"""Test the document spell checker."""
monkeypatch.setattr(QMenu, "exec", lambda *a: None)
monkeypatch.setattr(QMenu, "setParent", lambda *a: None)
buildTestProject(nwGUI, projPath)
assert nwGUI.openDocument(C.hSceneDoc) is True
+1
View File
@@ -70,6 +70,7 @@ def testToolWelcome_Main(qtbot: QtBot, monkeypatch, nwGUI, fncPath):
def testToolWelcome_Open(qtbot: QtBot, monkeypatch, nwGUI, fncPath):
"""Test the open tab in the Welcome window."""
monkeypatch.setattr(QMenu, "exec", lambda *a: None)
monkeypatch.setattr(QMenu, "setParent", lambda *a: None)
CONFIG.recentProjects.update("/stuff/project_one", "Project One", 12345, 1690000000)
CONFIG.recentProjects.update("/stuff/project_two", "Project Two", 54321, 1700000000)