本文整理汇总了Python中PyQt5.QtQuick.QQuickView类的典型用法代码示例。如果您正苦于以下问题:Python QQuickView类的具体用法?Python QQuickView怎么用?Python QQuickView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QQuickView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
QQuickView.__init__(self)
surface_format = QSurfaceFormat()
surface_format.setAlphaBufferSize(8)
self.setColor(QColor(0, 0, 0, 0))
self.setFlags(
Qt.Tool
| Qt.FramelessWindowHint
| Qt.WindowStaysOnTopHint
| Qt.X11BypassWindowManagerHint
)
self.setResizeMode(QQuickView.SizeRootObjectToView)
self.setFormat(surface_format)
self.set_all_contexts()
self.setSource(QUrl.fromLocalFile(os.path.join(
ROOT_LOCATION, 'frame', 'views', 'Main.qml')))
self.connect_all_object_function()
self.engine_obj = self.engine()
connect_to_primary_changed(self.display_primary_changed)
self._dbus_adptor = DssDbusAdptor(self)
qApp.focusWindowChanged.connect(self.onFocusWindowChanged)
示例2: __init__
def __init__(self, settings, windowInfo):
QQuickView.__init__(self)
self._settings = settings
surface_format = QSurfaceFormat()
surface_format.setAlphaBufferSize(8)
self.set_cursor_shape("shape_start_cursor")
self.setColor(QColor(0, 0, 0, 0))
self.setFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
self.setResizeMode(QQuickView.SizeRootObjectToView)
self.setFormat(surface_format)
self.setTitle(_("Deepin screenshot"))
self.qimage = QImage(self._settings.tmpImageFile)
self.qpixmap = QPixmap()
self.qpixmap.convertFromImage(self.qimage)
self.window_info = windowInfo
self._grabPointerStatus = False
self._grabKeyboardStatus = False
self._grabFocusTimer = self._getGrabFocusTimer()
self._osdShowed = False
self._osdShowing = False
self._quitOnOsdTimeout = False
示例3: __init__
def __init__(self, x, y, menuJsonContent, withCorner):
QQuickView.__init__(self)
self.__x = x
self.__y = y
self.__menuJsonContent = menuJsonContent
self.__withCorner = withCorner
self._cornerDirection = "down"
示例4: __init__
def __init__(self):
QQuickView.__init__(self)
surface_format = QSurfaceFormat()
surface_format.setAlphaBufferSize(8)
self.setColor(QColor(0, 0, 0, 0))
self.setFlags(QtCore.Qt.FramelessWindowHint)
self.setResizeMode(QtQuick.QQuickView.SizeRootObjectToView)
self.setFormat(surface_format)
self.qml_context = self.rootContext()
示例5: add_qml_import_path
def add_qml_import_path(self, view: QQuickView) -> None:
"""
Manually set the path to the QML folder to fix errors with unicode paths.
This is needed only on Windows when packaged with Nuitka.
"""
if Options.freezer != "nuitka":
return
qml_dir = Options.res_dir.parent / "PyQt5" / "Qt" / "qml"
log.debug(f"Setting QML import path for {view} to {qml_dir!r}")
view.engine().addImportPath(str(qml_dir))
示例6: main
def main():
print("start")
app = QApplication(sys.argv)
qmlRegisterType(Person, 'People', 1, 0, 'Person')
v = QQuickView(QUrl("testFindChild.qml"))
qmlRoot = v.rootObject()
assert isinstance(qmlRoot, QQuickItem)
assert isinstance(qmlRoot, QObject)
dumpQMLComponents(qmlRoot)
result = qmlRoot.findChild(Person, "person")
assert result is not None
sys.exit(app.exec_())
示例7: createQuickView
def createQuickView(self, transientParent=None):
"""
Create empty QQuickView.
More robust: connects to error.
Subsequently, you should set context and then setSource()
"""
result = QQuickView()
result.statusChanged.connect(self.onStatusChanged)
assert transientParent is not None
print("transientParent is:", transientParent, transientParent.isTopLevel())
result.setTransientParent(transientParent)
assert result is not None
assert isinstance(result, QQuickView)
return result
示例8: __init__
def __init__(self):
self._controller = Controller(self)
self._gui = QGuiApplication(sys.argv)
self._qml_dir = os.path.dirname(os.path.realpath(__file__))
self._main = QQuickView()
self._main.setResizeMode(QQuickView.SizeRootObjectToView)
self._main.setSource(QUrl(self._qml_dir + "/main.qml"))
self._main.rootObject().create_node.connect(self._controller.create_node)
self._main.rootObject().mouse_position.connect(self._controller.mouse_position)
self._main.rootObject().save.connect(self._controller.save)
self._main.rootObject().load.connect(self._controller.load)
self._main.rootObject().lose_focus.connect(self._controller.lose_focus)
self._main.rootObject().node_color_sel.connect(self._controller.node_color_sel)
self._main.rootObject().edge_color_sel.connect(self._controller.edge_color_sel)
self._main.rootObject().workspace_size_changed.connect(self._controller.window_resize)
self._main.rootObject().edge_type_sel.connect(self._controller.edge_type_sel)
self._main.rootObject().node_shape_sel.connect(self._controller.node_shape_sel)
self._main.rootObject().clear_workspace.connect(self._controller.clear_workspace)
self._main.rootObject().node_width_changed.connect(self._controller.node_width_changed)
self._main.rootObject().node_height_changed.connect(self._controller.node_height_changed)
self._main.rootObject().node_text_color_sel.connect(self._controller.node_text_color_sel)
self._main.rootObject().node_text_size_changed.connect(self._controller.node_text_size_changed)
self._main.rootObject().edge_thickness_changed.connect(self._controller.edge_thickness_changed)
self._main.rootObject().show_edge_controls.connect(self._controller.show_edge_controls)
self._main.rootObject().hide_edge_controls.connect(self._controller.hide_edge_controls)
self._main.rootObject().exporting.connect(self._controller.exporting)
self._main.setProperty("width", self._controller.project.workspace_width)
self._main.setProperty("height", self._controller.project.workspace_height)
self._main.show()
示例9: __init__
def __init__(self, center=False):
QQuickView.__init__(self)
self._center_request_count = 1 if center else 0
surface_format = QSurfaceFormat()
surface_format.setAlphaBufferSize(8)
self.setColor(QColor(0, 0, 0, 0))
self.setMinimumSize(QSize(MINIMIZE_WIDTH, MINIMIZE_HEIGHT))
self.setResizeMode(QtQuick.QQuickView.SizeRootObjectToView)
self.setFormat(surface_format)
self.staysOnTop = False
self.qml_context = self.rootContext()
self.setTitle(_("Deepin Movie"))
self.setIcon(icon_from_theme("Deepin", "deepin-movie"))
self.setDeepinWindowShadowHint(self.windowGlowRadius)
示例10: __init__
def __init__(self, emacs_xid, init_width, init_height):
QQuickView.__init__(self)
surface_format = QSurfaceFormat()
surface_format.setAlphaBufferSize(8)
self.setColor(QColor(0, 0, 0, 0))
self.setFlags(QtCore.Qt.FramelessWindowHint)
self.setResizeMode(QtQuick.QQuickView.SizeRootObjectToView)
self.setFormat(surface_format)
self.qml_context = self.rootContext()
self.emacs_xid = int(emacs_xid)
self.emacs_width = int(init_width)
self.emacs_height = int(init_height)
self.show()
示例11: quickViewForQML
def quickViewForQML(self, qmlFilename, transientParent=None):
'''
Create a QQuickView for qmlFilename.
More robust: connects to error
'''
quickView = QQuickView()
quickView.statusChanged.connect(self.onStatusChanged)
qurl = resourceMgr.urlToQMLResource(resourceSubpath=qmlFilename)
quickView.setSource(qurl)
'''
Show() the enclosing QWindow?
But this means the window for e.g. the toolbar is visible separately?
'''
#quickView.show()
print("Created QQuickView for:", qurl.path())
if transientParent is not None:
quickView.setTransientParent(transientParent)
return quickView
示例12: MainWindow
class MainWindow(QtCore.QObject):
def __init__(self):
QtCore.QObject.__init__(self)
self._controller = Controller()
self.view = QQuickView()
full_path = os.path.realpath(__file__)
folder = os.path.dirname(full_path)
qml_file = os.path.join(folder, 'qml', 'App.qml')
qml_qurl = QtCore.QUrl.fromLocalFile(qml_file)
self.view.setSource(qml_qurl)
# Add context properties to use this objects from qml
rc = self.view.rootContext()
rc.setContextProperty('controller', self._controller)
def show(self):
self.view.show()
示例13: run
def run():
signal.signal(signal.SIGINT, signal.SIG_DFL)
app = QGuiApplication(sys.argv)
view = QQuickView()
view.setTitle('Hot reloading demo')
qml_engine = view.rootContext().engine()
qml_engine.addImportPath(lib_dir_path)
notifier = HotReloadNotifier(demo_dir_path, qml_engine, parent=app)
view.rootContext().setContextProperty('hotReloadNotifier', notifier)
qml_url = QUrl.fromLocalFile(os.path.join(demo_dir_path, 'Demo.qml'))
view.setSource(qml_url)
view.show()
exit_code = app.exec_()
# notifier.stop() # seems like this is not needed
sys.exit(exit_code)
示例14: __init__
def __init__(self, qml_file):
QQuickView.__init__(self)
surface_format = QSurfaceFormat()
surface_format.setAlphaBufferSize(8)
self.setColor(QColor(0, 0, 0, 0))
self.setResizeMode(QtQuick.QQuickView.SizeRootObjectToView)
self.setFormat(surface_format)
self.setFlags(QtCore.Qt.Popup)
self.qml_context = self.rootContext()
self.init_translate_info()
self.qml_context.setContextProperty("translateInfo", self.translate_info)
self.qml_context.setContextProperty("windowView", self)
self.qml_context.setContextProperty("settingConfig", setting_config)
self.qml_context.setContextProperty("qApp", qApp)
self.setSource(QtCore.QUrl.fromLocalFile(os.path.join(get_parent_dir(__file__), qml_file)))
示例15: __init__
def __init__(self, parent=None):
QQuickView.__init__(self, parent)
if getattr(sys, "frozen", ""):
qml_path = os.path.join(app.executable_dir(), "qml")
else:
qml_path = os.path.expanduser("~/git/fs-uae/fs-uae-launcher/qml")
engine = self.engine()
print(engine.importPathList())
print(engine.pluginPathList())
# engine.setPluginPathList([qml_path, "."])
# engine.addPluginPath(qml_path)
# engine.addImportPath(qml_path)
# engine.setPluginPathList([qml_path, "."])
# engine.setImportPathList([qml_path])
# engine.addPluginPath(qml_path)
# print("setImportPathList", [QUrl.fromLocalFile(qml_path)])
self.setSource(QUrl.fromLocalFile(
os.path.join(qml_path, "ScaledUserInterface.qml")))