From 0f825a5fe26693da26707d9ac99af48d0602079b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 20 Nov 2023 13:11:57 +0100 Subject: Scene Graph Painted Item Example: Prototypically enable QML debugging Task-number: PYSIDE-2206 Change-Id: I8112a1bd5c6020373d11a70a0043ccd1273735de Reviewed-by: Cristian Maureira-Fredes Reviewed-by: Fabian Kosmale (cherry picked from commit 9f33028bfaa45a36a50738e6b8b8f8014f5fbfd9) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit d650a09764defb1cf206827485e0be24b34c6075) --- examples/quick/painteditem/painteditem.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/quick/painteditem/painteditem.py b/examples/quick/painteditem/painteditem.py index 180e22943..cf5a05ada 100644 --- a/examples/quick/painteditem/painteditem.py +++ b/examples/quick/painteditem/painteditem.py @@ -1,12 +1,13 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from argparse import ArgumentParser, RawTextHelpFormatter from pathlib import Path import sys from PySide6.QtGui import QPainter, QBrush, QColor from PySide6.QtWidgets import QApplication -from PySide6.QtQml import QmlElement +from PySide6.QtQml import QmlElement, QQmlDebuggingEnabler from PySide6.QtCore import QUrl, Property, Signal, Qt, QPointF from PySide6.QtQuick import QQuickPaintedItem, QQuickView @@ -62,6 +63,13 @@ class TextBalloon(QQuickPaintedItem): if __name__ == "__main__": + argument_parser = ArgumentParser(description="Scene Graph Painted Item Example", + formatter_class=RawTextHelpFormatter) + argument_parser.add_argument("-qmljsdebugger", action="store", + help="Enable QML debugging") + options = argument_parser.parse_args() + if options.qmljsdebugger: + QQmlDebuggingEnabler.enableDebugging(True) app = QApplication(sys.argv) view = QQuickView() view.setResizeMode(QQuickView.SizeRootObjectToView) -- cgit v1.2.3