本文整理匯總了Python中PyQt5.QtQuick.QQuickView方法的典型用法代碼示例。如果您正苦於以下問題:Python QtQuick.QQuickView方法的具體用法?Python QtQuick.QQuickView怎麽用?Python QtQuick.QQuickView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtQuick
的用法示例。
在下文中一共展示了QtQuick.QQuickView方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from PyQt5 import QtQuick [as 別名]
# 或者: from PyQt5.QtQuick import QQuickView [as 別名]
def __init__(self, engine=None, parent=None):
super(DQuickView, self).__init__(engine, parent)
self.setResizeMode(QtQuick.QQuickView.SizeViewToRootObject)
self.engine().addImportPath(os.sep.join([get_parent_dir(__file__, 2),
'qml']))
if isWebengineUsed:
# self.initWebengine()
pass
format = QSurfaceFormat()
format.setAlphaBufferSize(8)
format.setRenderableType(QSurfaceFormat.OpenGL)
self.setFormat(format)
self.setColor(QColor(Qt.transparent))
self.setClearBeforeRendering(True)
示例2: __init__
# 需要導入模塊: from PyQt5 import QtQuick [as 別名]
# 或者: from PyQt5.QtQuick import QQuickView [as 別名]
def __init__(self, parent=None):
super().__init__(parent)
self.setIcon(QtGui.QIcon(ICON_PATH))
rootContext = self.rootContext()
rootContext.setContextProperty('windowView', self)
self.setResizeMode(QtQuick.QQuickView.SizeRootObjectToView)
surface_format = QtGui.QSurfaceFormat()
surface_format.setAlphaBufferSize(8)
self.setFormat(surface_format)
self.setColor(QtGui.QColor(0, 0, 0, 0))
self.setFlags(QtCore.Qt.FramelessWindowHint |
QtCore.Qt.Window |
QtCore.Qt.WindowStaysOnTopHint)
self.setSource(QtCore.QUrl.fromLocalFile(views.CONFIRM_WINDOW))
示例3: QmlWidget
# 需要導入模塊: from PyQt5 import QtQuick [as 別名]
# 或者: from PyQt5.QtQuick import QQuickView [as 別名]
def QmlWidget(qmlpath: str, context: dict, parent: QWidget) -> QWidget:
"""
Generate a QtWidgets widget from a QML file.
:qmlpath
The pat of the QML file.
:context
The context objects to expose to QML.
"""
qmlpath = os.fspath(qmlpath)
view = QQuickView()
engine = view.engine()
for name, obj in context.items():
engine.rootContext().setContextProperty(name, obj)
container = QWidget.createWindowContainer(view, parent)
container.setStyleSheet("Widget { padding: 7px; }")
view.setSource(QUrl.fromLocalFile(qmlpath))
return container
示例4: myview
# 需要導入模塊: from PyQt5 import QtQuick [as 別名]
# 或者: from PyQt5.QtQuick import QQuickView [as 別名]
def myview(self):
path = 'py_mqltest.qml' # 加載的QML文件
self.view = QQuickView()
self.view.setSource(QUrl(path))
self.container = QWidget.createWindowContainer(self.view);
self.verticalLayout.addWidget(self.container)
示例5: __init__
# 需要導入模塊: from PyQt5 import QtQuick [as 別名]
# 或者: from PyQt5.QtQuick import QQuickView [as 別名]
def __init__(self, parent=None):
super().__init__(parent)
self.setIcon(QtGui.QIcon(ICON_PATH))
rootContext = self.rootContext()
rootContext.setContextProperty('windowView', self)
self.setResizeMode(QtQuick.QQuickView.SizeRootObjectToView)
surface_format = QtGui.QSurfaceFormat()
surface_format.setAlphaBufferSize(8)
self.setFormat(surface_format)
self.setColor(QtGui.QColor(0, 0, 0, 0))
self.setFlags(QtCore.Qt.SplashScreen |
QtCore.Qt.WindowStaysOnTopHint)
self.setSource(QtCore.QUrl.fromLocalFile(views.DISCONNECT_WINDOW))
# When `Disconnect` button clicked, show a confirmation dialog
root = self.rootObject()
root.disconnected.connect(self.showConfirmWindow)
self.confirm_window = None
QtCore.QCoreApplication.instance().aboutToQuit.connect(
self.disconnected)
示例6: show
# 需要導入模塊: from PyQt5 import QtQuick [as 別名]
# 或者: from PyQt5.QtQuick import QQuickView [as 別名]
def show(self):
self._event_record.start()
QtQuick.QQuickView.show(self)
self.oldVisibility = self.visibility()
示例7: __init__
# 需要導入模塊: from PyQt5 import QtQuick [as 別名]
# 或者: from PyQt5.QtQuick import QQuickView [as 別名]
def __init__(self):
QtQuick.QQuickView.__init__(self)
self.setIcon(QtGui.QIcon(ICON_PATH))
self._event_handler = EventHandler()
self._event_handler.cursorPositionChanged.connect(
self._record_cursor_position)
self._event_record = EventRecord()
self._event_record.captureEvent.connect(
self._event_handler.handle_event)
# Mouse event
self._event_record.captureEvent.connect(mouse.handle_mouse_event)
self.preferencesMenu = PreferencesMenu()
rootContext = self.rootContext()
rootContext.setContextProperty('windowView', self)
rootContext.setContextProperty('eventHandler', self._event_handler)
rootContext.setContextProperty('preferencesMenu',
self.preferencesMenu)
# Do not kill qApp when main window is closed, instead emiting a
#window-closed signal so that client dbus can send
# a STATUS_STOPPED signal to control panel
QtWidgets.qApp.setQuitOnLastWindowClosed(False)
self.setResizeMode(QtQuick.QQuickView.SizeRootObjectToView)
surface_format = QtGui.QSurfaceFormat()
surface_format.setAlphaBufferSize(8)
self.setFormat(surface_format)
self.setColor(QtGui.QColor(0, 0, 0, 0))
self.setFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Window)
self.setSource(QtCore.QUrl.fromLocalFile(views.MAIN_WINDOW))
self.root = self.rootObject()
QtWidgets.qApp.focusWindowChanged.connect(self.onWindowFocusChanged)
self.root.screenLevelChanged.connect(self.onScreenLevelChanged)
# Old visiblity of window
self.oldVisibility = QtGui.QWindow.Windowed
self.maxButtonClicked = False
self.requireMaximized = False
self.windowStateChanged.connect(self.onWindowStateChanged)