File tree Expand file tree Collapse file tree
activity_browser/ui/widgets Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,6 +118,19 @@ def connect_signals(self):
118118 self .tabCloseRequested .connect (self .tabClosed )
119119 signals .project .changed .connect (self .deleteLater )
120120
121+ def addTab (self , widget , * args , ** kwargs ):
122+ super ().addTab (widget , * args , ** kwargs )
123+ widget .destroyed .connect (self .checkEmpty )
124+
125+ def checkEmpty (self ):
126+ """
127+ Check if the GroupTabWidget is empty (i.e., has no tabs).
128+
129+ If it is empty, delete the widget.
130+ """
131+ if self .count () == 1 :
132+ self .deleteLater ()
133+
121134 def tabClosed (self , index ):
122135 """
123136 Handle the closing of a tab.
@@ -129,7 +142,4 @@ def tabClosed(self, index):
129142 index (int): The index of the tab to be closed.
130143 """
131144 self .widget (index ).deleteLater () # Delete the widget associated with the tab.
132- self .removeTab (index ) # Remove the tab from the widget.
133145
134- if self .count () == 0 : # If no tabs remain, delete the entire widget.
135- self .deleteLater ()
You can’t perform that action at this time.
0 commit comments