本文整理汇总了Python中qtpy.QtWidgets.QWidget.browse_btn方法的典型用法代码示例。如果您正苦于以下问题:Python QWidget.browse_btn方法的具体用法?Python QWidget.browse_btn怎么用?Python QWidget.browse_btn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtWidgets.QWidget
的用法示例。
在下文中一共展示了QWidget.browse_btn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_file_combobox
# 需要导入模块: from qtpy.QtWidgets import QWidget [as 别名]
# 或者: from qtpy.QtWidgets.QWidget import browse_btn [as 别名]
def create_file_combobox(self, text, choices, option, default=NoDefault,
tip=None, restart=False, filters=None,
adjust_to_contents=False,
default_line_edit=False):
"""choices: couples (name, key)"""
combobox = FileComboBox(self, adjust_to_contents=adjust_to_contents,
default_line_edit=default_line_edit)
combobox.restart_required = restart
combobox.label_text = text
edit = combobox.lineEdit()
edit.label_text = text
edit.restart_required = restart
self.lineedits[edit] = (option, default)
if tip is not None:
combobox.setToolTip(tip)
combobox.addItems(choices)
msg = _('Invalid file path')
self.validate_data[edit] = (osp.isfile, msg)
browse_btn = QPushButton(ima.icon('FileIcon'), '', self)
browse_btn.setToolTip(_("Select file"))
browse_btn.clicked.connect(lambda: self.select_file(edit, filters))
layout = QGridLayout()
layout.addWidget(combobox, 0, 0, 0, 9)
layout.addWidget(browse_btn, 0, 10)
layout.setContentsMargins(0, 0, 0, 0)
widget = QWidget(self)
widget.combobox = combobox
widget.browse_btn = browse_btn
widget.setLayout(layout)
return widget