本文整理汇总了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)