Delete QWebViews when tabs are closed.

This commit is contained in:
Florian Bruhin 2014-02-11 11:17:53 +01:00
parent 26787b0d30
commit 83276b9576

View File

@ -73,6 +73,8 @@ class TabbedBrowser(TabWidget):
space.setContext(Qt.WidgetWithChildrenShortcut)
space.activated.connect(self.space_scroll)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.tabCloseRequested.connect(lambda idx:
self.widget(idx).deleteLater())
def tabopen(self, url):
"""Open a new tab with a given url.
@ -141,6 +143,8 @@ class TabbedBrowser(TabWidget):
# FIXME maybe we actually should store the webview objects here
self._url_stack.append(tab.url())
self.removeTab(idx)
# Mark the QWebView to be deleted later in the main Qt loop.
tab.deleteLater()
else:
# FIXME
pass