I found the answer:
http://developer.qt.nokia.com/faq/an...ed_qdockwidget
EDIT: Or not. Spoke too soon. QDockWidgets use QTabBar but they don't use QTabWidget! So how am I meant to see which QDockWidget belongs to which QTabBar so I can restore the state?
Here is my saving code (saving tab positions)
# --------
tabWidgetsAll
= self.
parent().
findChildren(QTabWidget, None
) # tab widgets which contain QDockWidget
tabWidgets = []
if len(tabWidgets) > 0:
print 'yay'
for w in widgets:
for tab in tabWidgetsAll:
if tab in tabWidgets:
continue
if tab.indexOf(w) != -1:
tabWidgets.append(tab)
for tab in tabWidgets:
self.activeTabs.append((tab, tab.currentIndex()))
# --------
tabWidgetsAll = self.parent().findChildren(QTabWidget, None)
# tab widgets which contain QDockWidget
tabWidgets = []
if len(tabWidgets) > 0:
print 'yay'
for w in widgets:
for tab in tabWidgetsAll:
if tab in tabWidgets:
continue
if tab.indexOf(w) != -1:
tabWidgets.append(tab)
for tab in tabWidgets:
self.activeTabs.append((tab, tab.currentIndex()))
To copy to clipboard, switch view to plain text mode
In that snippet 'yay' is never printed, indicating that no QTabWidget's exist and that QDockWidget doesn't use that for tabifying itself. Although it DOES use QTabBar and I'm able to reset the active tab using that (although I have no way to confirm which QTabBar belongs to which QTabWidget or if at all).
And here is the restoration code:
# --------
for tab in self.activeTabs:
tab[0].setCurrentIndex(tab[1])
self.activeTabs = []
# --------
for tab in self.activeTabs:
tab[0].setCurrentIndex(tab[1])
self.activeTabs = []
To copy to clipboard, switch view to plain text mode
Bookmarks