Close tabs when their close icon is clicked.

master
Pacman Ghost 7 years ago
parent d56760eb1e
commit 8ef48c38eb
  1. 5
      main_window.py

@ -86,6 +86,7 @@ class MainWindow( QMainWindow ) :
# we can now close the startup widget and replace it with the main tab widget
self.tab_widget = QTabWidget( self )
self.tab_widget.setTabsClosable( True )
self.tab_widget.tabCloseRequested.connect( self.on_tab_close_requested )
self.setCentralWidget( self.tab_widget )
# open the database
db.open_database( db_fname , False )
@ -119,6 +120,10 @@ class MainWindow( QMainWindow ) :
return i
return None
def on_tab_close_requested( self , index ) :
"""Handle the tab close request."""
self.tab_widget.removeTab( index )
def closeEvent( self , evt ) :
"""Handle window close."""
# confirm the close

Loading…
Cancel
Save