def main():
# This is required so that app.quit can be invoked when the quickview
# is closed. If it is not present then the app does not exit. It is
# possibly a bug in PyQt or Qt.
global app
app = QtWidgets.QApplication(sys.argv)
quickview = QtQuick.QQuickView()
if getattr(sys, 'frozen', None):
basedir = sys._MEIPASS
else:
basedir = os.path.dirname(__file__)
# The app dir is in the default import path but we can't put the QtQuick
# import lib dirs there because of a name clash (on OSX) with the QtQuick
# dll.
print(("Qt5 Qml import paths: " \
+ unicode(quickview.engine().importPathList())))
quickview.setSource(QtCore.QUrl('qrc:/hello.qml'))
quickview.engine().quit.connect(app.quit)
quickview.show()
app.exec_()
评论列表
文章目录