Hi,
I am trying to create scrollArea under my tabWidget.
I have already written code for creating widgets under my tab widgets but now i wanted scrollArea. running code with scrollArea i can not se any Widgets in my scrollArea and maya is geting crached if i move the window or change the tab.
Below Code is working perfectly fine WITHOUT scrollArea In my tabWidget:
def buildTabLodUpdate(self):
# all tabs in widget
tabs = [self.buildTabWidget.tabText(index) for index in range(self.buildTabWidget.count())]
allLod = [lod for lod in self.uiData["spModularRig"]["rig"]]
# if lod exist deleting default tab
if len(allLod) > 0:
# deleting default tab if exists
if "spModularRig" in tabs:
self.buildTabWidget.removeTab(0)
# creating tab for all lod and updating widgets.
for lod in allLod:
if lod.keys()[0] not in tabs:
W_lod = QtWidgets.QWidget()
VerL_lod = QtWidgets.QVBoxLayout(W_lod)
self.buildTabWidget.addTab(W_lod, lod.keys()[0])
self.buildTabWidget.setCurrentIndex(self.buildTabWidget.count()-1)
# updating rig data widgets inside tab
self.buildTabSWUpdate()
def buildTabSWUpdate(self):
self.buildTabSWRemoveAll()
Widget = self.buildTabWidget.currentWidget()
layout = Widget.findChild(QtWidgets.QVBoxLayout)
for num, rigData in enumerate(self.uiData["spModularRig"]["rig"][self.lodIndex][self.selectedLodName]):
GB_name = self.uiData["spModularRig"]["rig"][self.lodIndex][self.selectedLodName][num][rigData.keys()[0]]["name"]
if rigData.keys()[0] == "rigInfo":
# gathering data from dictionary.
assetName = self.uiData["spModularRig"]["rig"][self.lodIndex][self.selectedLodName][num][rigData.keys()[0]]["assetName"]
assetType = self.uiData["spModularRig"]["rig"][self.lodIndex][self.selectedLodName][num][rigData.keys()[0]]["assetType"]
assetOtherType = self.uiData["spModularRig"]["rig"][self.lodIndex][self.selectedLodName][num][rigData.keys()[0]]["OtherType"]
# creating widget with above values.
rigInfoW = self.rigInfoUIFunc(Widget, layout, GB_name, assetName, assetType, assetOtherType)
# connecting.
rigInfoW.LE_assetName.editingFinished.connect(lambda data=[num, rigInfoW.LE_assetName]: self.RI_assetNameUpdate(data))
rigInfoW.LE_assetOtherType.editingFinished.connect(lambda data=[num, rigInfoW.LE_assetOtherType]: self.RI_assetOtherTypeUpdate(data))
rigInfoW.ComB_assetType.currentIndexChanged.connect(self.RI_assetTypeUpdate)
rigInfoW.B_applyRigInfo.clicked.connect(self.applyRigInfo)
below is the code where i am adding scrollArea:
def buildTabLodUpdate(self):
# all tabs in widget
tabs = [self.buildTabWidget.tabText(index) for index in range(self.buildTabWidget.count())]
allLod = [lod for lod in self.uiData["spModularRig"]["rig"]]
# if lod exist deleting default tab
if len(allLod) > 0:
# deleting default tab if exists
if "spModularRig" in tabs:
self.buildTabWidget.removeTab(0)
# creating tab for all lod and updating widgets.
for lod in allLod:
if lod.keys()[0] not in tabs:
W_lod = QtWidgets.QWidget()
VerL_lod = QtWidgets.QVBoxLayout(W_lod)
SA_buildTab = QtWidgets.QScrollArea(W_lod)
SA_buildTab.setObjectName("SA_buildTab")
SA_W_rigData = QtWidgets.QWidget()
SA_W_rigData.setObjectName("SA_W_rigData")
VerL_SA_W_rigData = QtWidgets.QVBoxLayout(SA_W_rigData)
VerL_SA_W_rigData.setObjectName("VerL_SA_W_rigData")
SA_buildTab.setWidget(SA_W_rigData)
VerL_lod.addWidget(SA_buildTab)
self.buildTabWidget.addTab(W_lod, lod.keys()[0])
self.buildTabWidget.setCurrentIndex(self.buildTabWidget.count()-1)
# updating rig data widgets inside tab
self.buildTabSWUpdate()
def buildTabSWUpdate(self):
self.buildTabSWRemoveAll()
Widget = [Widget for Widget in self.buildTabWidget.currentWidget().findChildren(QtWidgets.QWidget) if Widget.objectName() == "SA_W_rigData"][0]
layout = Widget.findChild(QtWidgets.QVBoxLayout)
for num, rigData in enumerate(self.uiData["spModularRig"]["rig"][self.lodIndex][self.selectedLodName]):
GB_name = self.uiData["spModularRig"]["rig"][self.lodIndex][self.selectedLodName][num][rigData.keys()[0]]["name"]
if rigData.keys()[0] == "rigInfo":
# gathering data from dictionary.
assetName = self.uiData["spModularRig"]["rig"][self.lodIndex][self.selectedLodName][num][rigData.keys()[0]]["assetName"]
assetType = self.uiData["spModularRig"]["rig"][self.lodIndex][self.selectedLodName][num][rigData.keys()[0]]["assetType"]
assetOtherType = self.uiData["spModularRig"]["rig"][self.lodIndex][self.selectedLodName][num][rigData.keys()[0]]["OtherType"]
# creating widget with above values.
rigInfoW = self.rigInfoUIFunc(Widget, layout, GB_name, assetName, assetType, assetOtherType)
# connecting.
rigInfoW.LE_assetName.editingFinished.connect(lambda data=[num, rigInfoW.LE_assetName]: self.RI_assetNameUpdate(data))
rigInfoW.LE_assetOtherType.editingFinished.connect(lambda data=[num, rigInfoW.LE_assetOtherType]: self.RI_assetOtherTypeUpdate(data))
rigInfoW.ComB_assetType.currentIndexChanged.connect(self.RI_assetTypeUpdate)
rigInfoW.B_applyRigInfo.clicked.connect(self.applyRigInfo)
What am i doing wrong here?