我有 QTabWidget,以及我想在这个 QTabWidget 选项卡中显示的一些小部件和子布局的布局。我想要做的是将此布局添加到第一个选项卡(默认情况下),如果用户移动到下一个选项卡,我想显示完全相同的布局,并在它附近添加一些小部件。这是我正在谈论的布局:
self.right_tab_layout = QVBoxLayout()
self.right_tab_widget = QWidget()
self.right_tab_title_label = QLabel("Select full files path:")
self.simoderev_layout = QHBoxLayout()
self.simoderev_widget = QWidget()
self.simoderev_checkbox = QCheckBox("use simoderev as base: ")
self.simoderev_combobox = QComboBox()
self.paths_label = QLabel("paths:")
self.right_tab_widget.setLayout(self.right_tab_layout)
self.simoderev_widget.setLayout(self.simoderev_layout)
self.simoderev_widget.setMaximumWidth(250)
self.simoderev_layout.addWidget(self.simoderev_checkbox)
self.simoderev_layout.addWidget(self.simoderev_combobox)
self.simoderev_layout.setContentsMargins(0,0,0,0)
self.right_tab_layout.addWidget(self.right_tab_title_label)
self.right_tab_layout.addWidget(self.simoderev_widget)
self.right_tab_layout.addWidget(self.paths_label)
有什么办法吗?