PyQt/Test/partner_625781186/QML_QtQuick_PY/QDialog中嵌入qml窗体并缩放/py_qml.py

33 lines
805 B
Python
Raw Normal View History

2018-04-16 23:17:51 +08:00
# -*- coding: utf-8 -*-
"""
Module implementing Dialog.
"""
from PyQt5 import QtGui, QtWidgets, QtCore
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtQuickWidgets import *
from Ui_py_qml import Ui_Dialog
class Dialog(QDialog, Ui_Dialog):
def __init__(self, parent=None):
super(Dialog, self).__init__(parent)
self.setupUi(self)
self.m_quickWidget=QQuickWidget();
self.m_quickWidget.setResizeMode(QQuickWidget.SizeRootObjectToView) ;
self.m_quickWidget.setSource(QUrl("py_mqltest.qml"));
self.verticalLayout.addWidget(self.m_quickWidget)
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Dialog = Dialog()
Dialog.show()
sys.exit(app.exec_())