Get pinned status from parent
This commit is contained in:
parent
77703c5263
commit
67c108a320
@ -108,10 +108,7 @@ class TabWidget(QTabWidget):
|
|||||||
tab: The tab to pin
|
tab: The tab to pin
|
||||||
pinned: Pinned tab state to set.
|
pinned: Pinned tab state to set.
|
||||||
"""
|
"""
|
||||||
bar = self.tabBar()
|
|
||||||
idx = self.indexOf(tab)
|
idx = self.indexOf(tab)
|
||||||
|
|
||||||
bar.set_tab_data(idx, 'pinned', pinned)
|
|
||||||
tab.data.pinned = pinned
|
tab.data.pinned = pinned
|
||||||
self.update_tab_favicon(tab)
|
self.update_tab_favicon(tab)
|
||||||
self.update_tab_title(idx)
|
self.update_tab_title(idx)
|
||||||
@ -570,10 +567,10 @@ class TabBar(QTabBar):
|
|||||||
|
|
||||||
def _tab_pinned(self, index: int) -> bool:
|
def _tab_pinned(self, index: int) -> bool:
|
||||||
"""Return True if tab is pinned."""
|
"""Return True if tab is pinned."""
|
||||||
try:
|
if not 0 <= index < self.count():
|
||||||
return self.tab_data(index, 'pinned')
|
raise IndexError("Tab index ({}) out of range ({})!".format(
|
||||||
except KeyError:
|
index, self.count()))
|
||||||
return False
|
return self.parent().widget(index).data.pinned
|
||||||
|
|
||||||
def tabSizeHint(self, index: int):
|
def tabSizeHint(self, index: int):
|
||||||
"""Override tabSizeHint to customize qb's tab size.
|
"""Override tabSizeHint to customize qb's tab size.
|
||||||
|
Loading…
Reference in New Issue
Block a user