src/eric7/Testing/TestingWidget.py

branch
eric7
changeset 10442
bf4a24c55c57
parent 10439
21c28b0f9e41
child 10451
aa89d938d5cf
diff -r a79201e0e149 -r bf4a24c55c57 src/eric7/Testing/TestingWidget.py
--- a/src/eric7/Testing/TestingWidget.py	Sun Dec 24 19:49:52 2023 +0100
+++ b/src/eric7/Testing/TestingWidget.py	Mon Dec 25 12:48:30 2023 +0100
@@ -12,11 +12,12 @@
 import locale
 import os
 
-from PyQt6.QtCore import QCoreApplication, QEvent, Qt, pyqtSignal, pyqtSlot
+from PyQt6.QtCore import QCoreApplication, QEvent, QPoint, Qt, pyqtSignal, pyqtSlot
 from PyQt6.QtWidgets import (
     QAbstractButton,
     QComboBox,
     QDialogButtonBox,
+    QMenu,
     QTreeWidgetItem,
     QWidget,
 )
@@ -241,6 +242,14 @@
 
         self.__markersWindow = None
 
+        self.__discoveryListContextMenu = QMenu(self.discoveryList)
+        self.__discoveryListContextMenu.addAction(
+            self.tr("Collapse All"), self.discoveryList.collapseAll
+        )
+        self.__discoveryListContextMenu.addAction(
+            self.tr("Expand All"), self.discoveryList.expandAll
+        )
+
         # connect some signals
         self.discoveryPicker.editTextChanged.connect(self.__resetResults)
         self.testsuitePicker.editTextChanged.connect(self.__resetResults)
@@ -1547,6 +1556,16 @@
 
         return selectedTests
 
+    @pyqtSlot(QPoint)
+    def on_discoveryList_customContextMenuRequested(self, pos):
+        """
+        Private slot to show the context menu of the dicovery list.
+
+        @param pos the position of the mouse pointer
+        @type QPoint
+        """
+        self.__discoveryListContextMenu.exec(self.discoveryList.mapToGlobal(pos))
+
 
 class TestingWindow(EricMainWindow):
     """

eric ide

mercurial