2019-02-02 01:13:14 +08:00
|
|
|
|
#!/usr/bin/env python
|
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
Created on 2019年2月2日
|
|
|
|
|
@author: Irony
|
2021-07-13 14:52:26 +08:00
|
|
|
|
@site: https://pyqt.site , https://github.com/PyQt5
|
2019-02-02 01:13:14 +08:00
|
|
|
|
@email: 892768447@qq.com
|
|
|
|
|
@file: QtQuick.FlatStyle
|
|
|
|
|
@description:
|
|
|
|
|
"""
|
|
|
|
|
import os
|
|
|
|
|
import sys
|
|
|
|
|
|
2021-07-13 14:52:26 +08:00
|
|
|
|
try:
|
|
|
|
|
from PyQt5.QtCore import QCoreApplication, Qt, QUrl
|
|
|
|
|
from PyQt5.QtQml import QQmlApplicationEngine
|
|
|
|
|
from PyQt5.QtWidgets import QApplication, QMessageBox
|
|
|
|
|
except ImportError:
|
|
|
|
|
from PySide2.QtCore import QCoreApplication, Qt, QUrl
|
|
|
|
|
from PySide2.QtQml import QQmlApplicationEngine
|
|
|
|
|
from PySide2.QtWidgets import QApplication, QMessageBox
|
2019-02-02 01:13:14 +08:00
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
try:
|
|
|
|
|
QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
|
|
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
os.chdir('FlatStyle')
|
|
|
|
|
|
|
|
|
|
app = QApplication(sys.argv)
|
|
|
|
|
engine = QQmlApplicationEngine()
|
|
|
|
|
engine.objectCreated.connect(
|
2021-07-13 14:52:26 +08:00
|
|
|
|
lambda obj, _: (
|
|
|
|
|
QMessageBox.critical(None, '错误', '运行失败,可能是当前PyQt版本不支持'), engine.quit) if not obj else 0)
|
2019-02-02 01:13:14 +08:00
|
|
|
|
engine.addImportPath('imports')
|
|
|
|
|
engine.load(QUrl('flatstyle.qml'))
|
|
|
|
|
|
|
|
|
|
sys.exit(app.exec_())
|