所以我有 2 个 QCheckBoxes 列表,它们驱动彼此的状态变化。每个列表驻留在一个选项卡中,该选项卡属于一组选项卡,属于一个主选项卡。当我生成复选框时,我一次生成一个选项卡,每个选项卡都有一个唯一的名称。我想知道我是否可以选中列表 1 中的特定复选框并在列表 2 中更改特定复选框的状态?
前任。结构
mainTab1 > tab 1 > list 1 checkBox 1-9
> tab 2 > list 1 checkBox 1-4
> tab 3 > list 1 checkBox 1-6
mainTab2 > tab 1 > list 2 checkBox 1-3
> tab 2 > list 2 checkBox 1-11
> tab 3 > list 2 checkBox 1-8
使用这种结构,如果我检查 mainTab1>tab2>list1checkBox3,我希望 mainTab2>tab1>list2checkBox1 检查该更改,我应该如何连接我的信号?
这是实际生成选项卡和复选框的代码
global clusterNames
global parseByPass
totalPasses = parseByPass.keys()
totalPasses.sort()
cNames = reversed(clusterNames)
assetCBList, assetNameList, assetPassList, assetROList = [],[],[],[]
passCBList, passNameList, passPassList, passROList = [],[],[],[]
#Create the main window
self.setFixedSize(900,600)
self.setWindowTitle("Que Dispatcher")
#Create all the layouts to be used by main window
self.windowLayout = QtGui.QVBoxLayout()
self.buttonShelf = QtGui.QHBoxLayout()
#Create the tab widget
self.tabGroupMain = QtGui.QTabWidget(self)
self.tabGroupMain.setObjectName("tabGroupMain")
self.tabGroupMain.setGeometry(QtCore.QRect(10,10,875,530))
self.tabGroupSub = QtGui.QTabWidget(self)
self.tabGroupSub.setObjectName("tabGroupSub")
self.tabGroupSub.setGeometry(QtCore.QRect(10,10,865,520))
self.tabGroupSub.setStyleSheet("border: 0px")
self.tabGroupSub2 = QtGui.QTabWidget(self)
self.tabGroupSub2.setObjectName("tabGroupSub2")
self.tabGroupSub2.setGeometry(QtCore.QRect(10,10,865,520))
self.tabGroupSub2.setStyleSheet("border: 0px")
#Create all the tabs and add them to the tab widget
#Asset tab
for index, item in enumerate(cNames):
currentTab = item + "Tab"
self.currentTab = QtGui.QWidget()
self.currentTab.setObjectName(currentTab)
#Create the top line, all control widgets
self.tabV = QtGui.QVBoxLayout()
self.tabScroll = QtGui.QScrollArea()
self.tabLayout = QtGui.QGridLayout()
self.tabLayout.setColumnMinimumWidth(1,175)
self.tabLayout.setColumnMinimumWidth(2,125)
self.tabLayout.setRowMinimumHeight(1,15)
self.allCB = QtGui.QCheckBox()
self.allCB.setObjectName("%sAllCB" % item)
self.allNameLabel = QtGui.QLabel("Cluster Name")
self.allNameLabel.setObjectName("%sAllNameLable" % item)
self.allPassLabel = QtGui.QLabel("Pass Type")
self.allPassLabel.setObjectName("%sAllPassLabel" % item)
self.allRenderOpt = QtGui.QLineEdit("Render Options: Insert Commands")
self.allRenderOpt.setObjectName("%sAllRenderOpt" % item)
#Create modullar widgets based on parsed info
for index, stat in enumerate(QParsed[item][1]):
statedRO = ""
assetCB = item + stat + "CheckBox"
assetNameLabel = item + stat + "NameLabel"
assetPassLabel = item + stat + "PassLabel"
assetRO = item + stat + "ROTF"
for text in QParsed[item][2][index]:
statedRO = statedRO + text + " "
#Add modularly generated widgets with parsed info
self.assetCB = QtGui.QCheckBox()
self.assetCB.setObjectName(assetCB)
self.assetNameLabel = QtGui.QLabel(item)
self.assetNameLabel.setObjectName(assetNameLabel)
self.assetPassLabel = QtGui.QLabel(stat)
self.assetPassLabel.setObjectName(assetPassLabel)
self.assetRenderOpt = QtGui.QLineEdit(statedRO)
self.assetRenderOpt.setObjectName(assetRO)
#Add the all control widgets to a horizontal layout
self.tabLayout.addWidget(self.allCB,0,0)
self.tabLayout.addWidget(self.allNameLabel,0,1)
self.tabLayout.addWidget(self.allPassLabel,0,2)
self.tabLayout.addWidget(self.allRenderOpt,0,3)
#Add all modullar widgets
self.tabLayout.addWidget(self.assetCB, (index+2), 0, QtCore.Qt.AlignTop)
self.tabLayout.addWidget(self.assetNameLabel, (index +2), 1, QtCore.Qt.AlignTop)
self.tabLayout.addWidget(self.assetPassLabel, (index +2), 2, QtCore.Qt.AlignTop)
self.tabLayout.addWidget(self.assetRenderOpt, (index +2), 3, QtCore.Qt.AlignTop)
#Add layout to page of current tab widget
self.tabV.addLayout(self.tabLayout)
self.tabScroll.setLayout(self.tabV)
self.tabScroll.setMinimumHeight(850)
self.tabV.addStretch()
self.tabGroupSub.addTab(self.tabScroll, item)