src/eric7/EricWidgets/EricSideBar.py

branch
eric7
changeset 10500
40fc136e7002
parent 10439
21c28b0f9e41
child 10689
3ede487187f2
diff -r 71208bcc7d99 -r 40fc136e7002 src/eric7/EricWidgets/EricSideBar.py
--- a/src/eric7/EricWidgets/EricSideBar.py	Sat Jan 13 13:01:09 2024 +0100
+++ b/src/eric7/EricWidgets/EricSideBar.py	Sun Jan 14 12:39:11 2024 +0100
@@ -10,7 +10,7 @@
 import enum
 import json
 
-from PyQt6.QtCore import QSize, Qt, pyqtSlot
+from PyQt6.QtCore import QSize, Qt, pyqtSignal, pyqtSlot
 from PyQt6.QtWidgets import QBoxLayout, QStackedWidget, QWidget
 
 from .EricIconBar import EricIconBar
@@ -31,10 +31,15 @@
     """
     Class implementing a sidebar with a widget area, that is hidden or shown,
     if the current tab is clicked again.
+
+    @signal currentChanged(index) emitted to indicate a change of the current
+        index
     """
 
     Version = 4
 
+    currentChanged = pyqtSignal(int)
+
     def __init__(
         self, orientation=None, iconBarSize=EricIconBar.DefaultBarSize, parent=None
     ):
@@ -148,6 +153,8 @@
         if self.isMinimized():
             self.__expandIt()
 
+        self.currentChanged.emit(index)
+
     def addTab(self, widget, icon, label=None):
         """
         Public method to add a tab to the sidebar.
@@ -201,6 +208,17 @@
         else:
             self.__minSize = self.minimumSizeHint().width()
 
+    def setTabIcon(self, index, icon):
+        """
+        Public method to set the icon at the given index.
+
+        @param index icon index
+        @type int
+        @param icon reference to the icon
+        @type QIcon
+        """
+        self.__iconBar.setIcon(index, icon)
+
     def clear(self):
         """
         Public method to remove all tabs.

eric ide

mercurial