QTabWidget's Tab widgets and their contents are floating (Pyside2)

99 Views Asked by At

I am developing using pyside2 in maya. I need to create a two-tab QTabWidget, within which will be two widgets containing further group boxes / buttons etc.

I cannot work out why my GUI, although showing me my two Tabs in the main window, has the contents of the Tabs floating in a fresh window ? Its like they are unparented, my assumption was using the addTab method would mean they are inheriting the main window and parenting ?

    self.mainTab = qw.QTabWidget()
    self.mainTab.resize(300,900)
    self.createTab = qw.QWidget()
    self.editTab = qw.QWidget()
    self.createTab.layout = qw.QVBoxLayout()
    self.editTab.layout = qw.QVBoxLayout()
    self.mainTab.addTab(self.createTab,"Create")
    self.mainTab.addTab(self.editTab,"Edit")



    self.createTab.layout.addWidget(self.tools_text)
    self.createTab.layout.addWidget(self.tool_button_box)
    self.createTab.layout.addWidget(self.vertpath_context_box)
    self.createTab.layout.addWidget(self.edgepath_context_box)
    self.createTab.layout.addWidget(self.placement_context_box)
    self.createTab.layout.addWidget(self.scatter_context_box)

The mainTab is added later

    main_group_layout.addWidget(self.mainTab)
    main_group_layout.addStretch()

I've checked the contents of the Tabs before, and even added them directly to the main window - they all seem to be declared OK Do I need to be mindful of anything else ( eg adding widgets / adding Tabs ) to Thw QTabWidget to get them to work ? Nothing has occured like this yet until I introduced the Tabs

snapshot from maya

0

There are 0 best solutions below