test_pyqt5_qml.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:driveboardapp 作者: nortd 项目源码 文件源码
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_()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号