I have an extended main window with QtGui.QTabWidget added. I create several widgets extended from QtGui.QWidget , which I can add and remove to the tab widget.
What I would like to do is click the pop-up button, which will remove the child widget from the tab widget and come up with its own independent window (and the pop-in button) back to the main window). Same idea as Gtalk-in-Gmail. Please note that if I close the main window, other โtabsโ or โwindowsโ should also close, and I should be able to place all windows side by side and have them all visible and update at the same time. (I will show the data in real time).
I am new to Qt, but if I'm not mistaken if Widget has no parent, it occurs independently. This works, but then I have no idea how I could "pop" the window back.
class TCWindow(QtGui.QMainWindow): . . . def popOutWidget(self, child): i = self.tabHolder.indexOf(child) if not i == -1: self.tabCloseRequested(i) self.widgets[i].setParent(None) self.widgets[i].show()
My gut says that there should still be a relationship between them between parents and children.
Is there a way to save the parent, but still the window opens independently, or do I not understand the Qt style?
Otherwise, creating a variable in the child to bind to the main window (e.g. self.parentalUnit = self.parent() ) would be a good idea or the idea of โโhacks / kludgy?
python qt pyside
Laura wentworth
source share