我有一个看起来像这样的组框:
这是创建它的代码:
def create_settings_group(self):
group_box_settings = QtGui.QGroupBox(self)
group_box_settings.setTitle("Settings")
grid = QtGui.QGridLayout()
grid.addWidget(self.label_1, 3, 0)
grid.addWidget(self.label_2, 3, 2)
grid.addWidget(self.label_3, 0, 0)
grid.addWidget(self.label_4, 1, 0)
grid.addWidget(self.label_6, 2, 0)
grid.addWidget(self.label_7, 3, 4)
grid.addWidget(self.label_8, 3, 6)
grid.addWidget(self.label_9, 3, 8)
grid.addWidget(self.line_edit_1, 0, 1, 1, 9)
grid.addWidget(self.combo_box_1, 1, 1, 1, 8)
grid.addWidget(self.push_button_1, 1, 9)
grid.addWidget(self.combo_box_2, 2, 1, 1, 8)
grid.addWidget(self.push_button_2, 2, 9)
grid.addWidget(self.line_edit_2, 3, 1)
grid.addWidget(self.line_edit_3, 3, 3)
grid.addWidget(self.line_edit_4, 3, 5)
grid.addWidget(self.line_edit_5, 3, 7)
grid.addWidget(self.line_edit_6, 3, 9)
grid.addWidget(self.check_box_1, 0, 10)
grid.addWidget(self.check_box_2, 1, 10)
grid.addWidget(self.check_box_3, 2, 10)
group_box_settings.setLayout(grid)
return group_box_settings
可以看到加号按钮靠近组合框,但远离复选框。如何将组合框和按钮组合在一起,以便它们跨越它们下方的所有行编辑和标签?
基本上我想实现这样的目标: