本文整理汇总了Python中qtpy.QtWidgets.QGridLayout.setSizeConstraint方法的典型用法代码示例。如果您正苦于以下问题:Python QGridLayout.setSizeConstraint方法的具体用法?Python QGridLayout.setSizeConstraint怎么用?Python QGridLayout.setSizeConstraint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtWidgets.QGridLayout
的用法示例。
在下文中一共展示了QGridLayout.setSizeConstraint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _build_GUI
# 需要导入模块: from qtpy.QtWidgets import QGridLayout [as 别名]
# 或者: from qtpy.QtWidgets.QGridLayout import setSizeConstraint [as 别名]
def _build_GUI(self, linelist, table_view):
panel_layout = QGridLayout()
panel_layout.setSizeConstraint(QLayout.SetMaximumSize)
self.setLayout(panel_layout)
# GUI cannot be completely defined in a .ui file.
# It has to be built on-the-fly here.
self.button_pane = QWidget()
loadUi(os.path.join(os.path.dirname(__file__), "ui", "linelists_panel_buttons.ui"), self.button_pane)
# internal signals do not use Hub infrastructure.
self.button_pane.create_set_button.clicked.connect(self._create_set)
self.button_pane.deselect_button.clicked.connect(table_view.clearSelection)
# header with line list metadata.
info = QTextBrowser()
info.setMaximumHeight(100)
info.setAutoFillBackground(True)
info.setStyleSheet("background-color: rgb(230,230,230);")
for comment in linelist.meta['comments']:
info.append(comment)
# populate color picker
model = self.button_pane.combo_box_color.model()
for cname in ID_COLORS:
item = QStandardItem(cname)
item.setForeground(ID_COLORS[cname])
item.setData(QColor(ID_COLORS[cname]), role=Qt.UserRole)
model.appendRow(item)
# set validators
validator = QDoubleValidator()
validator.setRange(0.05, 0.95, decimals=2)
self.button_pane.height_textbox.setValidator(validator)
validator = QDoubleValidator()
validator.setRange(-1.e5, 1.e10, decimals=4)
self.button_pane.redshift_textbox.setValidator(validator)
model = self.button_pane.combo_box_z_units.model()
for uname in ['z', 'km/s']:
item = QStandardItem(uname)
model.appendRow(item)
# put it all together
panel_layout.addWidget(info,0,0)
panel_layout.addWidget(table_view,1,0)
panel_layout.addWidget(self.button_pane,2,0)