Handle tab titles via onUrlChanged
This commit is contained in:
parent
bf19cb7536
commit
ed0d0d8ff7
@ -130,6 +130,7 @@ class TabbedBrowser(TabWidget):
|
|||||||
self._filter.create(self.cur_statusbar_message))
|
self._filter.create(self.cur_statusbar_message))
|
||||||
tab.scroll_pos_changed.connect(
|
tab.scroll_pos_changed.connect(
|
||||||
self._filter.create(self.cur_scroll_perc_changed))
|
self._filter.create(self.cur_scroll_perc_changed))
|
||||||
|
tab.urlChanged.connect(self.on_url_changed)
|
||||||
tab.urlChanged.connect(self._filter.create(self.cur_url_changed))
|
tab.urlChanged.connect(self._filter.create(self.cur_url_changed))
|
||||||
# hintmanager
|
# hintmanager
|
||||||
tab.hintmanager.hint_strings_updated.connect(self.hint_strings_updated)
|
tab.hintmanager.hint_strings_updated.connect(self.hint_strings_updated)
|
||||||
@ -159,7 +160,7 @@ class TabbedBrowser(TabWidget):
|
|||||||
self._tabs.append(tab)
|
self._tabs.append(tab)
|
||||||
if url is not None:
|
if url is not None:
|
||||||
url = urlutils.qurl(url)
|
url = urlutils.qurl(url)
|
||||||
self.addTab(tab, urlutils.urlstring(url))
|
self.addTab(tab, "")
|
||||||
tab.openurl(url)
|
tab.openurl(url)
|
||||||
else:
|
else:
|
||||||
self.addTab(tab, "")
|
self.addTab(tab, "")
|
||||||
@ -392,6 +393,13 @@ class TabbedBrowser(TabWidget):
|
|||||||
else:
|
else:
|
||||||
logging.debug("ignoring title change")
|
logging.debug("ignoring title change")
|
||||||
|
|
||||||
|
@pyqtSlot('QUrl')
|
||||||
|
def on_url_changed(self, url):
|
||||||
|
"""Set the new URL as title if there's no title yet."""
|
||||||
|
idx = self.indexOf(self.sender())
|
||||||
|
if not self.tabText(idx):
|
||||||
|
self.setTabText(idx, urlutils.urlstring(url))
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def on_icon_changed(self):
|
def on_icon_changed(self):
|
||||||
"""Set the icon of a tab.
|
"""Set the icon of a tab.
|
||||||
|
Loading…
Reference in New Issue
Block a user