本文整理汇总了Python中Qt.QtCompat.load_ui方法的典型用法代码示例。如果您正苦于以下问题:Python QtCompat.load_ui方法的具体用法?Python QtCompat.load_ui怎么用?Python QtCompat.load_ui使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Qt.QtCompat
的用法示例。
在下文中一共展示了QtCompat.load_ui方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Qt import QtCompat [as 别名]
# 或者: from Qt.QtCompat import load_ui [as 别名]
def __init__(self):
super(Dialog, self).__init__()
layout = QtWidgets.QVBoxLayout(self)
layout.setContentsMargins(0, 10, 0, 0)
fname = os.path.splitext(__file__)[0] + ".ui"
self.ui = QtCompat.load_ui(fname=fname)
layout.addWidget(self.ui)
self.create_connections()
示例2: __init__
# 需要导入模块: from Qt import QtCompat [as 别名]
# 或者: from Qt.QtCompat import load_ui [as 别名]
def __init__(self):
super(PackageDialog, self).__init__()
main_layout = QtGui.QVBoxLayout(self)
self.mainWidget = QtCompat.load_ui(ui_path)
self.setWindowTitle(self.mainWidget.windowTitle())
main_layout.addWidget(self.mainWidget)
self.mainWidget.FileButton.clicked.connect(self.on_FileButton_clicked)
self.mainWidget.packButton.clicked.connect(self.on_packButton_clicked)
self.mainWidget.cancelButton.clicked.connect(self.close)
示例3: setup_ui
# 需要导入模块: from Qt import QtCompat [as 别名]
# 或者: from Qt.QtCompat import load_ui [as 别名]
def setup_ui(uifile, base_instance=None):
"""Load a Qt Designer .ui file and returns an instance of the user interface
Args:
uifile (str): Absolute path to .ui file
base_instance (QWidget): The widget into which UI widgets are loaded
Returns:
QWidget: the base instance
"""
ui = QtCompat.load_ui(uifile) # Qt.py mapped function
if not base_instance:
return ui
else:
for member in dir(ui):
if not member.startswith('__') and \
member is not 'staticMetaObject':
setattr(base_instance, member, getattr(ui, member))
return ui