当前位置: 首页>>代码示例>>Python>>正文


Python QtQuick.QQuickView方法代码示例

本文整理汇总了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) 
开发者ID:dragondjf,项目名称:QMusic,代码行数:18,代码来源:dquickview.py

示例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)) 
开发者ID:linuxdeepin,项目名称:deepin-remote-assistance,代码行数:20,代码来源:confirmwindow.py

示例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 
开发者ID:python-discord,项目名称:code-jam-5,代码行数:26,代码来源:qmltools.py

示例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) 
开发者ID:PyQt5,项目名称:PyQt,代码行数:8,代码来源:py_qml.py

示例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) 
开发者ID:linuxdeepin,项目名称:deepin-remote-assistance,代码行数:28,代码来源:disconnectwindow.py

示例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() 
开发者ID:linuxdeepin,项目名称:deepin-remote-assistance,代码行数:6,代码来源:mainwindow.py

示例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) 
开发者ID:linuxdeepin,项目名称:deepin-remote-assistance,代码行数:46,代码来源:mainwindow.py


注:本文中的PyQt5.QtQuick.QQuickView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。