src/eric7/EricWidgets/EricToolBox.py

branch
eric7
changeset 9874
b89dce027259
parent 9653
e67609152c5e
child 9876
800c539f8700
diff -r 38f3435daeef -r b89dce027259 src/eric7/EricWidgets/EricToolBox.py
--- a/src/eric7/EricWidgets/EricToolBox.py	Fri Mar 10 18:25:33 2023 +0100
+++ b/src/eric7/EricWidgets/EricToolBox.py	Sat Mar 11 11:53:44 2023 +0100
@@ -26,6 +26,19 @@
         """
         super().__init__(parent)
 
+    def setCurrentWidget(self, widget):
+        """
+        Public slot to set the current widget.
+
+        @param widget reference to the widget to become the current widget
+            (QWidget)
+        """
+        index = self.indexOf(widget)
+        if index < 0:
+            # not found, set first widget as default
+            index = 0
+        self.setCurrentIndex(index)
+
 
 class EricHorizontalToolBox(EricTabWidget):
     """
@@ -94,3 +107,16 @@
         @param enabled flag indicating the enabled state (boolean)
         """
         self.setTabEnabled(index, enabled)
+
+    def setCurrentWidget(self, widget):
+        """
+        Public slot to set the current widget.
+
+        @param widget reference to the widget to become the current widget
+            (QWidget)
+        """
+        index = self.indexOf(widget)
+        if index < 0:
+            # not found, set first widget as default
+            index = 0
+        self.setCurrentIndex(index)

eric ide

mercurial