當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。