1. Henning Schröder
  2. codeaide

Commits

Henning Schröder  committed 69df8b0

closable titlebar tabs

  • Participants
  • Parent commits 86978db
  • Branches default

Comments (0)

Files changed (1)

File codeaide/ide/base.py

View file
         if tab:
             if not tab in _installed_filters:
                 tab.installEventFilter(self)
+                tab.setTabsClosable(True)
+                tab.tabCloseRequested.connect(self.on_tab_close_request)
                 _installed_filters.append(tab)
                 self.style_tabbar(tab)
             if not self.titleBarWidget():
                 QTimer.singleShot(0, self.restore_titlebar)
 
 
+                
+    def on_tab_close_request(self, index):
+        tab = self.sender()
+        title = tab.tabText(index)
+        for child in self.parent().children():
+            if isinstance(child, QDockWidget):
+                if child.windowTitle() == title:
+                    child.close()
+                    return
+                    
+        
 
     def dock_tab(self, dock):
         title = dock.windowTitle()