aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/QtQml
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6/tests/QtQml')
-rw-r--r--sources/pyside6/tests/QtQml/CMakeLists.txt13
-rw-r--r--sources/pyside6/tests/QtQml/ModuleType.qml8
-rw-r--r--sources/pyside6/tests/QtQml/QtQml.pyproject65
-rw-r--r--sources/pyside6/tests/QtQml/bug_1029.py29
-rw-r--r--sources/pyside6/tests/QtQml/bug_1029.qml29
-rw-r--r--sources/pyside6/tests/QtQml/bug_451.py30
-rw-r--r--sources/pyside6/tests/QtQml/bug_451.qml29
-rw-r--r--sources/pyside6/tests/QtQml/bug_456.py34
-rw-r--r--sources/pyside6/tests/QtQml/bug_456.qml29
-rw-r--r--sources/pyside6/tests/QtQml/bug_557.py31
-rw-r--r--sources/pyside6/tests/QtQml/bug_726.py35
-rw-r--r--sources/pyside6/tests/QtQml/bug_726.qml29
-rw-r--r--sources/pyside6/tests/QtQml/bug_814.py40
-rw-r--r--sources/pyside6/tests/QtQml/bug_814.qml29
-rw-r--r--sources/pyside6/tests/QtQml/bug_825.py42
-rw-r--r--sources/pyside6/tests/QtQml/bug_825.qml29
-rw-r--r--sources/pyside6/tests/QtQml/bug_825_old.py80
-rw-r--r--sources/pyside6/tests/QtQml/bug_847.py33
-rw-r--r--sources/pyside6/tests/QtQml/bug_847.qml29
-rw-r--r--sources/pyside6/tests/QtQml/bug_915.py35
-rw-r--r--sources/pyside6/tests/QtQml/bug_926.py31
-rw-r--r--sources/pyside6/tests/QtQml/bug_926.qml29
-rw-r--r--sources/pyside6/tests/QtQml/bug_951.py35
-rw-r--r--sources/pyside6/tests/QtQml/bug_951.qml29
-rw-r--r--sources/pyside6/tests/QtQml/bug_995.py31
-rw-r--r--sources/pyside6/tests/QtQml/bug_995.qml29
-rw-r--r--sources/pyside6/tests/QtQml/bug_997.py56
-rw-r--r--sources/pyside6/tests/QtQml/bug_997.qml34
-rw-r--r--sources/pyside6/tests/QtQml/connect_python_qml.py36
-rw-r--r--sources/pyside6/tests/QtQml/connect_python_qml.qml29
-rw-r--r--sources/pyside6/tests/QtQml/groupedproperty.py112
-rw-r--r--sources/pyside6/tests/QtQml/groupedproperty.qml9
-rw-r--r--sources/pyside6/tests/QtQml/hw.qml29
-rw-r--r--sources/pyside6/tests/QtQml/javascript_exceptions.py29
-rw-r--r--sources/pyside6/tests/QtQml/javascript_exceptions.qml31
-rw-r--r--sources/pyside6/tests/QtQml/listproperty.py116
-rw-r--r--sources/pyside6/tests/QtQml/listproperty.qml50
-rw-r--r--sources/pyside6/tests/QtQml/qmlregistertype_test.py53
-rw-r--r--sources/pyside6/tests/QtQml/qmlregistertype_test.qml7
-rw-r--r--sources/pyside6/tests/QtQml/qqmlapplicationengine.qml23
-rw-r--r--sources/pyside6/tests/QtQml/qqmlapplicationengine_test.py38
-rw-r--r--sources/pyside6/tests/QtQml/qqmlcomponent_test.py36
-rw-r--r--sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py34
-rw-r--r--sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.qml29
-rw-r--r--sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile_component.qml29
-rw-r--r--sources/pyside6/tests/QtQml/qqmlnetwork_test.py55
-rw-r--r--sources/pyside6/tests/QtQml/qquickitem_grabToImage.py37
-rw-r--r--sources/pyside6/tests/QtQml/qquickitem_grabToImage.qml29
-rw-r--r--sources/pyside6/tests/QtQml/qquickview_test.py43
-rw-r--r--sources/pyside6/tests/QtQml/registerattached.py101
-rw-r--r--sources/pyside6/tests/QtQml/registerattached.qml20
-rw-r--r--sources/pyside6/tests/QtQml/registerextended.py74
-rw-r--r--sources/pyside6/tests/QtQml/registerextended.qml9
-rw-r--r--sources/pyside6/tests/QtQml/registerforeign.py52
-rw-r--r--sources/pyside6/tests/QtQml/registerforeign.qml8
-rw-r--r--sources/pyside6/tests/QtQml/registerparserstatus.py60
-rw-r--r--sources/pyside6/tests/QtQml/registerparserstatus.qml8
-rw-r--r--sources/pyside6/tests/QtQml/registerqmlfile.py30
-rw-r--r--sources/pyside6/tests/QtQml/registersingletontype.py125
-rw-r--r--sources/pyside6/tests/QtQml/registersingletontype.qml32
-rw-r--r--sources/pyside6/tests/QtQml/registertype.py35
-rw-r--r--sources/pyside6/tests/QtQml/registertype.qml29
-rw-r--r--sources/pyside6/tests/QtQml/registeruncreatable.qml29
-rw-r--r--sources/pyside6/tests/QtQml/registeruncreatabletype.py39
-rw-r--r--sources/pyside6/tests/QtQml/signal_arguments.py34
-rw-r--r--sources/pyside6/tests/QtQml/signal_arguments.qml29
-rw-r--r--sources/pyside6/tests/QtQml/signal_types.py124
-rw-r--r--sources/pyside6/tests/QtQml/signal_types.qml26
-rw-r--r--sources/pyside6/tests/QtQml/view.qml29
-rw-r--r--sources/pyside6/tests/QtQml/viewmodel.qml29
70 files changed, 1375 insertions, 1353 deletions
diff --git a/sources/pyside6/tests/QtQml/CMakeLists.txt b/sources/pyside6/tests/QtQml/CMakeLists.txt
index e35831f25..30bf7e786 100644
--- a/sources/pyside6/tests/QtQml/CMakeLists.txt
+++ b/sources/pyside6/tests/QtQml/CMakeLists.txt
@@ -1,8 +1,12 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
PYSIDE_TEST(bug_451.py)
PYSIDE_TEST(bug_456.py)
PYSIDE_TEST(bug_557.py)
PYSIDE_TEST(bug_726.py)
PYSIDE_TEST(bug_814.py)
+PYSIDE_TEST(bug_825_old.py)
PYSIDE_TEST(bug_825.py)
PYSIDE_TEST(bug_847.py)
PYSIDE_TEST(bug_915.py)
@@ -11,11 +15,20 @@ PYSIDE_TEST(bug_951.py)
PYSIDE_TEST(bug_995.py)
PYSIDE_TEST(bug_997.py)
PYSIDE_TEST(bug_1029.py)
+PYSIDE_TEST(groupedproperty.py)
PYSIDE_TEST(listproperty.py)
+PYSIDE_TEST(qmlregistertype_test.py)
+PYSIDE_TEST(qqmlapplicationengine_test.py)
PYSIDE_TEST(qqmlnetwork_test.py)
+PYSIDE_TEST(qqmlcomponent_test.py)
PYSIDE_TEST(qquickview_test.py)
PYSIDE_TEST(connect_python_qml.py)
+PYSIDE_TEST(registerattached.py)
+PYSIDE_TEST(registerextended.py)
+PYSIDE_TEST(registerparserstatus.py)
PYSIDE_TEST(registertype.py)
+PYSIDE_TEST(registerforeign.py)
+PYSIDE_TEST(registerqmlfile.py)
PYSIDE_TEST(registeruncreatabletype.py)
PYSIDE_TEST(registersingletontype.py)
PYSIDE_TEST(javascript_exceptions.py)
diff --git a/sources/pyside6/tests/QtQml/ModuleType.qml b/sources/pyside6/tests/QtQml/ModuleType.qml
new file mode 100644
index 000000000..d7e5e653c
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/ModuleType.qml
@@ -0,0 +1,8 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import QtQml
+
+QtObject {
+ objectName: "moduleType"
+}
diff --git a/sources/pyside6/tests/QtQml/QtQml.pyproject b/sources/pyside6/tests/QtQml/QtQml.pyproject
new file mode 100644
index 000000000..5a05c71a1
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/QtQml.pyproject
@@ -0,0 +1,65 @@
+{
+ "files": ["ModuleType.qml",
+ "bug_1029.py",
+ "bug_1029.qml",
+ "bug_451.py",
+ "bug_451.qml",
+ "bug_456.py",
+ "bug_456.qml",
+ "bug_557.py",
+ "bug_726.py",
+ "bug_726.qml",
+ "bug_814.py",
+ "bug_814.qml",
+ "bug_825.py",
+ "bug_825.qml",
+ "bug_847.py",
+ "bug_847.qml",
+ "bug_915.py",
+ "bug_926.py",
+ "bug_926.qml",
+ "bug_951.py",
+ "bug_951.qml",
+ "bug_995.py",
+ "bug_995.qml",
+ "bug_997.py",
+ "bug_997.qml",
+ "connect_python_qml.py",
+ "connect_python_qml.qml",
+ "groupedproperty.py",
+ "groupedproperty.qml",
+ "hw.qml",
+ "javascript_exceptions.py",
+ "javascript_exceptions.qml",
+ "listproperty.py",
+ "qqmlapplicationengine.qml",
+ "qqmlapplicationengine_test.py",
+ "qqmlincubator_incubateWhile.py",
+ "qqmlincubator_incubateWhile.qml",
+ "qqmlincubator_incubateWhile_component.qml",
+ "qqmlnetwork_test.py",
+ "qquickitem_grabToImage.py",
+ "qquickitem_grabToImage.qml",
+ "qquickview_test.py",
+ "registerattached.py",
+ "registerattached.qml",
+ "registerextended.py",
+ "registerextended.qml",
+ "registerforeign.py",
+ "registerforeign.qml",
+ "registerparserstatus.py",
+ "registerparserstatus.qml",
+ "registerqmlfile.py",
+ "registersingletontype.py",
+ "registersingletontype.qml",
+ "registertype.py",
+ "registertype.qml",
+ "registeruncreatable.qml",
+ "registeruncreatabletype.py",
+ "signal_arguments.py",
+ "signal_arguments.qml",
+ "signal_types.py",
+ "signal_types.qml",
+ "view.qml",
+ "viewmodel.qml"]
+}
diff --git a/sources/pyside6/tests/QtQml/bug_1029.py b/sources/pyside6/tests/QtQml/bug_1029.py
index c46df7736..69ca5c18d 100644
--- a/sources/pyside6/tests/QtQml/bug_1029.py
+++ b/sources/pyside6/tests/QtQml/bug_1029.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import gc
import os
diff --git a/sources/pyside6/tests/QtQml/bug_1029.qml b/sources/pyside6/tests/QtQml/bug_1029.qml
index 000a7568b..e4e95f865 100644
--- a/sources/pyside6/tests/QtQml/bug_1029.qml
+++ b/sources/pyside6/tests/QtQml/bug_1029.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
import UserTypes 1.0
diff --git a/sources/pyside6/tests/QtQml/bug_451.py b/sources/pyside6/tests/QtQml/bug_451.py
index ec157296e..d81a99d94 100644
--- a/sources/pyside6/tests/QtQml/bug_451.py
+++ b/sources/pyside6/tests/QtQml/bug_451.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''
Test bug 451: http://bugs.openbossa.org/show_bug.cgi?id=451
@@ -53,6 +28,7 @@ from PySide6.QtQml import QmlElement
QML_IMPORT_NAME = "test.PythonObject"
QML_IMPORT_MAJOR_VERSION = 1
+
@QmlElement
class PythonObject(QObject):
def __init__(self):
diff --git a/sources/pyside6/tests/QtQml/bug_451.qml b/sources/pyside6/tests/QtQml/bug_451.qml
index 77d6c5a13..0867b861f 100644
--- a/sources/pyside6/tests/QtQml/bug_451.qml
+++ b/sources/pyside6/tests/QtQml/bug_451.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
import test.PythonObject 1.0
diff --git a/sources/pyside6/tests/QtQml/bug_456.py b/sources/pyside6/tests/QtQml/bug_456.py
index 92d2dcb79..7743ee3fd 100644
--- a/sources/pyside6/tests/QtQml/bug_456.py
+++ b/sources/pyside6/tests/QtQml/bug_456.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -36,7 +11,7 @@ from init_paths import init_test_paths
init_test_paths(False)
from helper.helper import quickview_errorstring
-from helper.timedqapplication import TimedQApplication
+from helper.timedqguiapplication import TimedQGuiApplication
from PySide6.QtCore import QObject, QTimer, QUrl, Property, Slot
from PySide6.QtQuick import QQuickView
from PySide6.QtQml import QmlElement
@@ -44,6 +19,7 @@ from PySide6.QtQml import QmlElement
QML_IMPORT_NAME = "test.RotateValue"
QML_IMPORT_MAJOR_VERSION = 1
+
@QmlElement
class RotateValue(QObject):
def __init__(self):
@@ -62,7 +38,7 @@ class RotateValue(QObject):
rotation = Property(int, getRotation, setRotation)
-class TestConnectionWithInvalidSignature(TimedQApplication):
+class TestConnectionWithInvalidSignature(TimedQGuiApplication):
def testSlotRetur(self):
view = QQuickView()
diff --git a/sources/pyside6/tests/QtQml/bug_456.qml b/sources/pyside6/tests/QtQml/bug_456.qml
index d8afc56c9..092cca325 100644
--- a/sources/pyside6/tests/QtQml/bug_456.qml
+++ b/sources/pyside6/tests/QtQml/bug_456.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
import test.RotateValue 1.0
diff --git a/sources/pyside6/tests/QtQml/bug_557.py b/sources/pyside6/tests/QtQml/bug_557.py
index 17f9582e6..eb43973f6 100644
--- a/sources/pyside6/tests/QtQml/bug_557.py
+++ b/sources/pyside6/tests/QtQml/bug_557.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -48,6 +23,6 @@ component = QQmlComponent(engine)
# This should segfault if the QDeclarativeComponent has not QQmlEngine
file = Path(__file__).resolve().parent / 'foo.qml'
-assert(not file.is_file())
+assert (not file.is_file())
component.loadUrl(QUrl.fromLocalFile(file))
diff --git a/sources/pyside6/tests/QtQml/bug_726.py b/sources/pyside6/tests/QtQml/bug_726.py
index d94e9b086..56c1e70f1 100644
--- a/sources/pyside6/tests/QtQml/bug_726.py
+++ b/sources/pyside6/tests/QtQml/bug_726.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -36,13 +11,15 @@ from init_paths import init_test_paths
init_test_paths(False)
from helper.helper import quickview_errorstring
-from helper.timedqapplication import TimedQApplication
+from helper.timedqguiapplication import TimedQGuiApplication
from PySide6.QtCore import QObject, QUrl, Slot
from PySide6.QtQuick import QQuickView
from PySide6.QtQml import QmlElement
QML_IMPORT_NAME = "test.ProxyObject"
QML_IMPORT_MAJOR_VERSION = 1
+
+
@QmlElement
class ProxyObject(QObject):
def __init__(self):
@@ -64,7 +41,7 @@ class ProxyObject(QObject):
self._receivedName = name
-class TestConnectionWithInvalidSignature(TimedQApplication):
+class TestConnectionWithInvalidSignature(TimedQGuiApplication):
def testSlotRetur(self):
view = QQuickView()
diff --git a/sources/pyside6/tests/QtQml/bug_726.qml b/sources/pyside6/tests/QtQml/bug_726.qml
index aaca1a442..f80c9cdda 100644
--- a/sources/pyside6/tests/QtQml/bug_726.qml
+++ b/sources/pyside6/tests/QtQml/bug_726.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
import test.ProxyObject 1.0
diff --git a/sources/pyside6/tests/QtQml/bug_814.py b/sources/pyside6/tests/QtQml/bug_814.py
index 599a95e87..0e7858b6c 100644
--- a/sources/pyside6/tests/QtQml/bug_814.py
+++ b/sources/pyside6/tests/QtQml/bug_814.py
@@ -1,34 +1,7 @@
#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Copyright (C) 2011 Thomas Perl <m@thp.io>
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# Copyright (C) 2011 Thomas Perl <m@thp.io>
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
# Test case for PySide bug 814
# http://bugs.pyside.org/show_bug.cgi?id=814
@@ -47,7 +20,7 @@ from init_paths import init_test_paths
init_test_paths(False)
from helper.helper import quickview_errorstring
-from helper.timedqapplication import TimedQApplication
+from helper.timedqguiapplication import TimedQGuiApplication
from PySide6.QtCore import QUrl, QAbstractListModel, QModelIndex, Qt
from PySide6.QtQuick import QQuickView
@@ -56,13 +29,14 @@ from PySide6.QtQml import QmlElement
QML_IMPORT_NAME = "test.ListModel"
QML_IMPORT_MAJOR_VERSION = 1
+
@QmlElement
class ListModel(QAbstractListModel):
def __init__(self):
super().__init__()
def roleNames(self):
- return { Qt.DisplayRole: b'pysideModelData' }
+ return {Qt.DisplayRole: b'pysideModelData'}
def rowCount(self, parent=QModelIndex()):
return 3
@@ -73,7 +47,7 @@ class ListModel(QAbstractListModel):
return None
-class TestBug814(TimedQApplication):
+class TestBug814(TimedQGuiApplication):
def testAbstractItemModelTransferToQML(self):
view = QQuickView()
model = ListModel()
diff --git a/sources/pyside6/tests/QtQml/bug_814.qml b/sources/pyside6/tests/QtQml/bug_814.qml
index 2da245a6b..4331e424f 100644
--- a/sources/pyside6/tests/QtQml/bug_814.qml
+++ b/sources/pyside6/tests/QtQml/bug_814.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
import test.ListModel 1.0
diff --git a/sources/pyside6/tests/QtQml/bug_825.py b/sources/pyside6/tests/QtQml/bug_825.py
index 936cbd82b..a8bd304ec 100644
--- a/sources/pyside6/tests/QtQml/bug_825.py
+++ b/sources/pyside6/tests/QtQml/bug_825.py
@@ -1,30 +1,10 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+"""
+This is the corrected version for Python 3.
+Unfortunately, this touches a Python 3.8 error that was fixed late.
+"""
import os
import sys
@@ -50,8 +30,8 @@ class MetaA(type):
pass
-class A(object):
- __metaclass__ = MetaA
+class A(object, metaclass=MetaA):
+ pass
MetaB = type(QQuickPaintedItem)
@@ -62,8 +42,8 @@ class MetaC(MetaA, MetaB):
pass
-class C(A, B):
- __metaclass__ = MetaC
+class C(A, B, metaclass=MetaC):
+ pass
class Bug825 (C):
diff --git a/sources/pyside6/tests/QtQml/bug_825.qml b/sources/pyside6/tests/QtQml/bug_825.qml
index 6ae06d5b8..77c6b5014 100644
--- a/sources/pyside6/tests/QtQml/bug_825.qml
+++ b/sources/pyside6/tests/QtQml/bug_825.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
import bugs 1.0
diff --git a/sources/pyside6/tests/QtQml/bug_825_old.py b/sources/pyside6/tests/QtQml/bug_825_old.py
new file mode 100644
index 000000000..c44fa75f4
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/bug_825_old.py
@@ -0,0 +1,80 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+"""
+This is the now incorrect old version from Python 2.
+It happens to work in another way and will be retained.
+"""
+
+import os
+import sys
+import unittest
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from helper.helper import quickview_errorstring
+
+from PySide6.QtCore import Qt, QUrl, QTimer
+from PySide6.QtGui import QGuiApplication, QPen
+from PySide6.QtWidgets import QGraphicsItem
+from PySide6.QtQml import qmlRegisterType
+from PySide6.QtQuick import QQuickView, QQuickItem, QQuickPaintedItem
+
+paintCalled = False
+
+
+class MetaA(type):
+ pass
+
+
+class A(object):
+ __metaclass__ = MetaA
+
+
+MetaB = type(QQuickPaintedItem)
+B = QQuickPaintedItem
+
+
+class MetaC(MetaA, MetaB):
+ pass
+
+
+class C(A, B):
+ __metaclass__ = MetaC
+
+
+class Bug825 (C):
+ def __init__(self, parent=None):
+ QQuickPaintedItem.__init__(self, parent)
+
+ def paint(self, painter):
+ global paintCalled
+ pen = QPen(Qt.black, 2)
+ painter.setPen(pen)
+ painter.drawPie(self.boundingRect(), 0, 128)
+ paintCalled = True
+
+
+class TestBug825 (unittest.TestCase):
+ def testIt(self):
+ global paintCalled
+ app = QGuiApplication([])
+ qmlRegisterType(Bug825, 'bugs', 1, 0, 'Bug825')
+ self.assertRaises(TypeError, qmlRegisterType, A, 'bugs', 1, 0, 'A')
+
+ view = QQuickView()
+ file = Path(__file__).resolve().parent / 'bug_825.qml'
+ self.assertTrue(file.is_file())
+ view.setSource(QUrl.fromLocalFile(file))
+ self.assertTrue(view.rootObject(), quickview_errorstring(view))
+ view.show()
+ QTimer.singleShot(250, view.close)
+ app.exec()
+ self.assertTrue(paintCalled)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside6/tests/QtQml/bug_847.py b/sources/pyside6/tests/QtQml/bug_847.py
index f578392b0..947eb494e 100644
--- a/sources/pyside6/tests/QtQml/bug_847.py
+++ b/sources/pyside6/tests/QtQml/bug_847.py
@@ -1,34 +1,7 @@
#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Copyright (C) 2011 Thomas Perl <m@thp.io>
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# Copyright (C) 2011 Thomas Perl <m@thp.io>
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
# Testcase for PySide bug 847
# Released under the same terms as PySide itself
diff --git a/sources/pyside6/tests/QtQml/bug_847.qml b/sources/pyside6/tests/QtQml/bug_847.qml
index 3833b1637..18efd80ce 100644
--- a/sources/pyside6/tests/QtQml/bug_847.qml
+++ b/sources/pyside6/tests/QtQml/bug_847.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
diff --git a/sources/pyside6/tests/QtQml/bug_915.py b/sources/pyside6/tests/QtQml/bug_915.py
index 312ee341b..3095eba2a 100644
--- a/sources/pyside6/tests/QtQml/bug_915.py
+++ b/sources/pyside6/tests/QtQml/bug_915.py
@@ -1,33 +1,6 @@
#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -38,12 +11,12 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
-from helper.timedqapplication import TimedQApplication
+from helper.timedqguiapplication import TimedQGuiApplication
from PySide6.QtQuick import QQuickView, QQuickItem
-class TestBug915(TimedQApplication):
+class TestBug915(TimedQGuiApplication):
def testReturnPolicy(self):
view = QQuickView()
diff --git a/sources/pyside6/tests/QtQml/bug_926.py b/sources/pyside6/tests/QtQml/bug_926.py
index bbb000b01..085e9a68f 100644
--- a/sources/pyside6/tests/QtQml/bug_926.py
+++ b/sources/pyside6/tests/QtQml/bug_926.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import sys
import os
@@ -66,7 +41,7 @@ class MyClass (QObject):
class TestBug926 (unittest.TestCase):
def testIt(self):
app = QGuiApplication([])
- qmlRegisterType(MyClass,'Example', 1, 0, 'MyClass')
+ qmlRegisterType(MyClass, 'Example', 1, 0, 'MyClass')
view = QQuickView()
file = Path(__file__).resolve().parent / 'bug_926.qml'
self.assertTrue(file.is_file())
diff --git a/sources/pyside6/tests/QtQml/bug_926.qml b/sources/pyside6/tests/QtQml/bug_926.qml
index 9217403a4..6f7b608d0 100644
--- a/sources/pyside6/tests/QtQml/bug_926.qml
+++ b/sources/pyside6/tests/QtQml/bug_926.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
import Example 1.0
diff --git a/sources/pyside6/tests/QtQml/bug_951.py b/sources/pyside6/tests/QtQml/bug_951.py
index 75fc0b6eb..8a512d06f 100644
--- a/sources/pyside6/tests/QtQml/bug_951.py
+++ b/sources/pyside6/tests/QtQml/bug_951.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -36,7 +11,7 @@ from init_paths import init_test_paths
init_test_paths(False)
from helper.helper import quickview_errorstring
-from helper.timedqapplication import TimedQApplication
+from helper.timedqguiapplication import TimedQGuiApplication
from PySide6.QtCore import QUrl
from PySide6.QtQml import qmlRegisterType
@@ -55,9 +30,9 @@ class MyItem(QQuickItem):
super(MyItem, self).componentComplete()
-class TestRegisterQMLType(TimedQApplication):
+class TestRegisterQMLType(TimedQGuiApplication):
def setup(self):
- TimedQApplication.setup(self, 100 * 3) # 3s
+ super.setup(100 * 3) # 3s
def testSignalEmission(self):
qmlRegisterType(MyItem, "my.item", 1, 0, "MyItem")
diff --git a/sources/pyside6/tests/QtQml/bug_951.qml b/sources/pyside6/tests/QtQml/bug_951.qml
index 8242223f9..02bf0c708 100644
--- a/sources/pyside6/tests/QtQml/bug_951.qml
+++ b/sources/pyside6/tests/QtQml/bug_951.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
import my.item 1.0
diff --git a/sources/pyside6/tests/QtQml/bug_995.py b/sources/pyside6/tests/QtQml/bug_995.py
index 52a7b1d9d..868c584e2 100644
--- a/sources/pyside6/tests/QtQml/bug_995.py
+++ b/sources/pyside6/tests/QtQml/bug_995.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -44,7 +19,7 @@ from PySide6.QtQuick import QQuickView
app = QGuiApplication([])
file = Path(__file__).resolve().parent / 'bug_995.qml'
-assert(file.is_file())
+assert (file.is_file())
view = QQuickView(QUrl.fromLocalFile(file))
view.show()
view.resize(200, 200)
diff --git a/sources/pyside6/tests/QtQml/bug_995.qml b/sources/pyside6/tests/QtQml/bug_995.qml
index 1369dcca6..4f47cbd05 100644
--- a/sources/pyside6/tests/QtQml/bug_995.qml
+++ b/sources/pyside6/tests/QtQml/bug_995.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
diff --git a/sources/pyside6/tests/QtQml/bug_997.py b/sources/pyside6/tests/QtQml/bug_997.py
index 1f982e8cb..501c221c3 100644
--- a/sources/pyside6/tests/QtQml/bug_997.py
+++ b/sources/pyside6/tests/QtQml/bug_997.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -37,27 +12,38 @@ init_test_paths(False)
from helper.helper import quickview_errorstring
from helper.usesqapplication import UsesQApplication
-from PySide6.QtCore import QTimer, QUrl
+from PySide6.QtCore import QCoreApplication, QTimer, QUrl, Slot
from PySide6.QtQml import QQmlPropertyMap
from PySide6.QtQuick import QQuickView
class TestBug(UsesQApplication):
+
+ def setUp(self):
+ super().setUp()
+ self._complete = False
+
+ @Slot()
+ def complete(self):
+ self._complete = True
+ self.app.quit()
+
def testQMLFunctionCall(self):
ownerData = QQmlPropertyMap()
ownerData.insert('name', 'John Smith')
ownerData.insert('phone', '555-5555')
ownerData.insert('newValue', '')
- view = QQuickView()
- view.setInitialProperties({'owner': ownerData})
+ self._view = QQuickView()
+ self._view.engine().quit.connect(self.complete)
+ self._view.setInitialProperties({'owner': ownerData})
file = Path(__file__).resolve().parent / 'bug_997.qml'
self.assertTrue(file.is_file())
- view.setSource(QUrl.fromLocalFile(file))
- self.assertTrue(view.rootObject(), quickview_errorstring(view))
- view.show()
- QTimer.singleShot(1000, self.app.quit)
- self.app.exec()
+ self._view.setSource(QUrl.fromLocalFile(file))
+ self.assertTrue(self._view.rootObject(), quickview_errorstring(self._view))
+ self._view.show()
+ if not self._complete:
+ self.app.exec()
self.assertEqual(ownerData.value('newName'), ownerData.value('name'))
diff --git a/sources/pyside6/tests/QtQml/bug_997.qml b/sources/pyside6/tests/QtQml/bug_997.qml
index e3e34855e..23188f31f 100644
--- a/sources/pyside6/tests/QtQml/bug_997.qml
+++ b/sources/pyside6/tests/QtQml/bug_997.qml
@@ -1,35 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
Text {
required property var owner
text: owner.name + " " + owner.phone
- Component.onCompleted: { owner.newName = owner.name }
+ Component.onCompleted: {
+ owner.newName = owner.name
+ Qt.quit()
+ }
}
diff --git a/sources/pyside6/tests/QtQml/connect_python_qml.py b/sources/pyside6/tests/QtQml/connect_python_qml.py
index 86273763d..2e60aec4f 100644
--- a/sources/pyside6/tests/QtQml/connect_python_qml.py
+++ b/sources/pyside6/tests/QtQml/connect_python_qml.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''
Test case for bug #442
@@ -43,13 +18,13 @@ from init_paths import init_test_paths
init_test_paths(False)
from helper.helper import quickview_errorstring
-from helper.timedqapplication import TimedQApplication
+from helper.timedqguiapplication import TimedQGuiApplication
from PySide6.QtCore import QObject, QUrl, SIGNAL
from PySide6.QtGui import QColor
from PySide6.QtQuick import QQuickItem, QQuickView
-class TestConnectionWithInvalidSignature(TimedQApplication):
+class TestConnectionWithInvalidSignature(TimedQGuiApplication):
def onButtonClicked(self):
self.buttonClicked = True
self.app.quit()
@@ -67,7 +42,8 @@ class TestConnectionWithInvalidSignature(TimedQApplication):
root = view.rootObject()
self.assertTrue(root, quickview_errorstring(view))
button = root.findChild(QObject, "buttonMouseArea")
- self.assertRaises(TypeError, QObject.connect, [button,SIGNAL('entered()'), self.onButtonFailClicked])
+ self.assertRaises(TypeError, QObject.connect,
+ [button, SIGNAL('entered()'), self.onButtonFailClicked])
button.entered.connect(self.onButtonClicked)
button.entered.emit()
view.show()
diff --git a/sources/pyside6/tests/QtQml/connect_python_qml.qml b/sources/pyside6/tests/QtQml/connect_python_qml.qml
index 249debf91..1ed171e96 100644
--- a/sources/pyside6/tests/QtQml/connect_python_qml.qml
+++ b/sources/pyside6/tests/QtQml/connect_python_qml.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
diff --git a/sources/pyside6/tests/QtQml/groupedproperty.py b/sources/pyside6/tests/QtQml/groupedproperty.py
new file mode 100644
index 000000000..4554d4b31
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/groupedproperty.py
@@ -0,0 +1,112 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+"""Test grouped properties (PYSIDE-1836)."""
+
+import os
+import sys
+import unittest
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from PySide6.QtCore import (QCoreApplication, QUrl, QObject, Property)
+from PySide6.QtQml import (QQmlComponent, QQmlEngine, QmlAnonymous, QmlElement)
+
+
+QML_IMPORT_NAME = "grouped"
+QML_IMPORT_MAJOR_VERSION = 1
+
+
+@QmlAnonymous
+class ShoeDescription(QObject):
+ def __init__(self, parent=None):
+ super().__init__(parent)
+ self._brand = ""
+ self._size = 0
+ self._price = 0
+
+ @Property(str)
+ def brand(self):
+ return self._brand
+
+ @brand.setter
+ def brand(self, b):
+ self._brand = b
+
+ @Property(int)
+ def size(self):
+ return self._size
+
+ @size.setter
+ def size(self, s):
+ self._size = s
+
+ @Property(int)
+ def price(self):
+ return self._price
+
+ @price.setter
+ def price(self, p):
+ self._price = p
+
+
+@QmlElement
+class Person(QObject):
+ def __init__(self, parent=None):
+ super().__init__(parent)
+ self._name = ""
+ self._shoe = ShoeDescription()
+
+ @Property(str)
+ def name(self):
+ return self._name
+
+ @name.setter
+ def name(self, n):
+ self._name = n
+
+ @Property(ShoeDescription)
+ def shoe(self):
+ return self._shoe
+
+
+def component_error(component):
+ result = ""
+ for e in component.errors():
+ if result:
+ result += "\n"
+ result += str(e)
+ return result
+
+
+class TestQmlGroupedProperties(unittest.TestCase):
+ def testIt(self):
+ app = QCoreApplication(sys.argv)
+ file = Path(__file__).resolve().parent / "groupedproperty.qml"
+ url = QUrl.fromLocalFile(file)
+ engine = QQmlEngine()
+ component = QQmlComponent(engine, url)
+ person = component.create()
+ self.assertTrue(person, component_error(component))
+
+ # Check the meta type of the property
+ meta_object = person.metaObject()
+ index = meta_object.indexOfProperty("shoe")
+ self.assertTrue(index > 0)
+ meta_property = meta_object.property(index)
+ meta_type = meta_property.metaType()
+ self.assertTrue(meta_type.isValid())
+
+ # Check the values
+ self.assertEqual(person.shoe.brand, "Bikey")
+ self.assertEqual(person.shoe.price, 90)
+ self.assertEqual(person.shoe.size, 12)
+
+ del engine
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside6/tests/QtQml/groupedproperty.qml b/sources/pyside6/tests/QtQml/groupedproperty.qml
new file mode 100644
index 000000000..d32bd6005
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/groupedproperty.qml
@@ -0,0 +1,9 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import grouped
+
+Person {
+ name: "Bob Jones"
+ shoe { size: 12; brand: "Bikey"; price: 90 }
+}
diff --git a/sources/pyside6/tests/QtQml/hw.qml b/sources/pyside6/tests/QtQml/hw.qml
index 8b086f31f..723901d96 100644
--- a/sources/pyside6/tests/QtQml/hw.qml
+++ b/sources/pyside6/tests/QtQml/hw.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
diff --git a/sources/pyside6/tests/QtQml/javascript_exceptions.py b/sources/pyside6/tests/QtQml/javascript_exceptions.py
index fe2518487..e2b530aaf 100644
--- a/sources/pyside6/tests/QtQml/javascript_exceptions.py
+++ b/sources/pyside6/tests/QtQml/javascript_exceptions.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
diff --git a/sources/pyside6/tests/QtQml/javascript_exceptions.qml b/sources/pyside6/tests/QtQml/javascript_exceptions.qml
index 60d96c89e..1ab0fa3bb 100644
--- a/sources/pyside6/tests/QtQml/javascript_exceptions.qml
+++ b/sources/pyside6/tests/QtQml/javascript_exceptions.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
import QtQuick.Controls 2.0
@@ -50,4 +25,4 @@ Rectangle {
obj.passTest(2);
}
}
-} \ No newline at end of file
+}
diff --git a/sources/pyside6/tests/QtQml/listproperty.py b/sources/pyside6/tests/QtQml/listproperty.py
index 0e1e3548f..884600d29 100644
--- a/sources/pyside6/tests/QtQml/listproperty.py
+++ b/sources/pyside6/tests/QtQml/listproperty.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2020 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -32,11 +7,25 @@ import unittest
from pathlib import Path
sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
-from init_paths import init_test_paths
+from init_paths import init_test_paths # noqa: E402
init_test_paths(False)
-from PySide6.QtCore import QObject
-from PySide6.QtQml import ListProperty
+from helper.usesqapplication import UsesQApplication # noqa: E402, F401
+
+from PySide6.QtCore import QObject, QUrl, Property, qInstallMessageHandler # noqa: E402
+from PySide6.QtQml import ListProperty, QmlElement # noqa: E402
+from PySide6.QtQuick import QQuickView # noqa: E402
+
+
+QML_IMPORT_NAME = "test.ListPropertyTest"
+QML_IMPORT_MAJOR_VERSION = 1
+
+output_messages = []
+
+
+def message_handler(mode, context, message):
+ global output_messages
+ output_messages.append(f"{message}")
class InheritsQObject(QObject):
@@ -47,7 +36,46 @@ def dummyFunc():
pass
-class TestListProperty(unittest.TestCase):
+@QmlElement
+class Person(QObject):
+ def __init__(self, parent=None):
+ super().__init__(parent=None)
+ self._name = ''
+ self._friends = []
+
+ def appendFriend(self, friend):
+ self._friends.append(friend)
+
+ def friendCount(self):
+ return len(self._friends)
+
+ def friend(self, index):
+ return self._friends[index]
+
+ def removeLastItem(self):
+ if len(self._friends) > 0:
+ self._friends.pop()
+
+ def replace(self, index, friend):
+ if 0 <= index < len(self._friends):
+ self._friends[index] = friend
+
+ def clear(self):
+ self._friends.clear()
+
+ @Property(str, final=True)
+ def name(self):
+ return self._name
+
+ @name.setter
+ def name(self, value):
+ self._name = value
+
+ friends = ListProperty(QObject, append=appendFriend, count=friendCount, at=friend,
+ removeLast=removeLastItem, replace=replace, clear=clear)
+
+
+class TestListProperty(UsesQApplication):
def testIt(self):
# Verify that type checking works properly
@@ -56,7 +84,7 @@ class TestListProperty(unittest.TestCase):
try:
ListProperty(QObject)
ListProperty(InheritsQObject)
- except:
+ except Exception:
type_check_error = True
self.assertFalse(type_check_error)
@@ -72,21 +100,37 @@ class TestListProperty(unittest.TestCase):
method_check_error = False
try:
- ListProperty(QObject, append=None, at=None, count=None, replace=None, clear=None, removeLast=None) # Explicitly setting None
+ ListProperty(QObject, append=None, at=None, count=None, replace=None, clear=None,
+ removeLast=None) # Explicitly setting None
ListProperty(QObject, append=dummyFunc)
ListProperty(QObject, count=dummyFunc, at=dummyFunc)
- except:
+ except Exception:
method_check_error = True
self.assertFalse(method_check_error)
try:
- ListPropery(QObject, append=QObject())
- except:
+ ListProperty(QObject, append=QObject())
+ except Exception:
method_check_error = True
self.assertTrue(method_check_error)
+ def testListPropParameters(self):
+ global output_messages
+ qInstallMessageHandler(message_handler)
+ view = QQuickView()
+ file = Path(__file__).resolve().parent / 'listproperty.qml'
+ self.assertTrue(file.is_file())
+ view.setSource(QUrl.fromLocalFile(file))
+ view.show()
+ self.assertEqual(output_messages[0], "List length: 3")
+ self.assertEqual(output_messages[1], "First element: Alice")
+ self.assertEqual(output_messages[2], "Removing last item: Charlie")
+ self.assertEqual(output_messages[3], "Replacing last item: Bob")
+ self.assertEqual(output_messages[4], "Replaced last item: David")
+ self.assertEqual(output_messages[5], "List length after clearing: 0")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtQml/listproperty.qml b/sources/pyside6/tests/QtQml/listproperty.qml
new file mode 100644
index 000000000..7b71e30ba
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/listproperty.qml
@@ -0,0 +1,50 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick 2.0
+import test.ListPropertyTest
+
+Rectangle {
+ width: 360
+ height: 360
+
+ Person {
+ id: person
+ friends: [
+ Person{
+ name: "Alice"
+ },
+ Person{
+ name: "Bob"
+ },
+ Person{
+ name: "Charlie"
+ }
+ ]
+ }
+
+ Person{
+ id: david
+ name: "David"
+ }
+
+ Component.onCompleted: {
+ // Access the length of the list
+ console.log("List length: " + person.friends.length);
+
+ // Access the first element of the list
+ console.log("First element: " + person.friends[0].name);
+
+ // Remove the last item of the list
+ console.log("Removing last item: " + person.friends.pop().name);
+
+ // Repalce the last item of the list
+ console.log("Replacing last item: " + person.friends[person.friends.length - 1].name);
+ person.friends[person.friends.length - 1] = david;
+ console.log("Replaced last item: " + person.friends[person.friends.length - 1].name);
+
+ // Clear the list
+ person.friends = [];
+ console.log("List length after clearing: " + person.friends.length);
+ }
+}
diff --git a/sources/pyside6/tests/QtQml/qmlregistertype_test.py b/sources/pyside6/tests/QtQml/qmlregistertype_test.py
new file mode 100644
index 000000000..0042d6fd3
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/qmlregistertype_test.py
@@ -0,0 +1,53 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import os
+import sys
+import unittest
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from helper.usesqapplication import UsesQApplication
+
+
+from PySide6.QtCore import QCoreApplication, QObject # noqa: F401
+from PySide6.QtQml import QQmlApplicationEngine, qmlRegisterType
+
+
+class BaseClass(QObject):
+ def __init__(self, p=None):
+ super().__init__(p)
+
+
+class ChildClass(BaseClass):
+ def __init__(self, p=None):
+ super().__init__(p)
+
+
+class TestQmlRegisterType(UsesQApplication):
+ """Test the legacy QML register functions."""
+
+ def test(self):
+ qmlRegisterType(BaseClass, 'test', 1, 0, 'BaseClass')
+ qmlRegisterType(ChildClass, 'test', 1, 0, 'ChildClass')
+ # PYSIDE-2709: qmlRegisterType() would set additional class info
+ # on the meta objects for registration which caused another meta
+ # object to be created, breaking inheritance.
+ child = ChildClass()
+ base = BaseClass()
+ self.assertTrue(child.metaObject().inherits(base.metaObject()))
+
+ engine = QQmlApplicationEngine()
+ file = Path(__file__).resolve().parent / 'qmlregistertype_test.qml'
+
+ engine.load(file)
+ rootObjects = engine.rootObjects()
+ self.assertTrue(rootObjects)
+ self.assertTrue(type(rootObjects[0]), ChildClass)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside6/tests/QtQml/qmlregistertype_test.qml b/sources/pyside6/tests/QtQml/qmlregistertype_test.qml
new file mode 100644
index 000000000..108bb84b1
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/qmlregistertype_test.qml
@@ -0,0 +1,7 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import test
+
+ChildClass {
+}
diff --git a/sources/pyside6/tests/QtQml/qqmlapplicationengine.qml b/sources/pyside6/tests/QtQml/qqmlapplicationengine.qml
new file mode 100644
index 000000000..77149ecdc
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/qqmlapplicationengine.qml
@@ -0,0 +1,23 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import QtQuick
+import QtQuick.Window
+
+Window {
+ width: 300
+ height: 200
+ visible: true
+
+ Item {
+ width: 200
+ height: 60
+ Text {
+ anchors {
+ verticalCenter: parent.verticalCenter;
+ horizontalCenter: parent.horizontalCenter;
+ }
+ text: "Text"
+ }
+ }
+}
diff --git a/sources/pyside6/tests/QtQml/qqmlapplicationengine_test.py b/sources/pyside6/tests/QtQml/qqmlapplicationengine_test.py
new file mode 100644
index 000000000..ea54e9e25
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/qqmlapplicationengine_test.py
@@ -0,0 +1,38 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+'''Test case for QQmlApplicationEngine'''
+
+import os
+import sys
+import unittest
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from helper.timedqguiapplication import TimedQGuiApplication
+
+from PySide6.QtCore import QUrl, QObject, QTimer, Qt
+from PySide6.QtQml import QQmlApplicationEngine
+
+
+class TestQQmlApplicationEngine(TimedQGuiApplication):
+
+ def testQQmlApplicationEngine(self):
+ engine = QQmlApplicationEngine()
+
+ qml_file_path = Path(__file__).resolve().parent / "qqmlapplicationengine.qml"
+
+ # PYSIDE-1736: load from a string.
+ engine.load(os.fspath(qml_file_path))
+ rootObjects = engine.rootObjects()
+ self.assertTrue(rootObjects)
+ window = rootObjects[0]
+ window.setTitle("TestQQmlApplicationEngine")
+ QTimer.singleShot(100, window.close)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside6/tests/QtQml/qqmlcomponent_test.py b/sources/pyside6/tests/QtQml/qqmlcomponent_test.py
new file mode 100644
index 000000000..5521c64fa
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/qqmlcomponent_test.py
@@ -0,0 +1,36 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import os
+import sys
+import unittest
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from PySide6.QtCore import Property, QObject
+from PySide6.QtQml import QQmlComponent
+
+
+class WithComponent(QObject):
+ def get_component(self):
+ return None
+
+ component = Property(QQmlComponent, fget=get_component)
+
+
+class TestQmlSupport(unittest.TestCase):
+
+ def testMetatypeValid(self):
+ m = WithComponent.staticMetaObject
+ c = m.property(m.indexOfProperty("component"))
+
+ self.assertTrue(c.typeId() > 0)
+ self.assertTrue(c.typeName() == "QQmlComponent*")
+ self.assertTrue(c.metaType().isValid())
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py b/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py
index 5c2bd86aa..12a73e398 100644
--- a/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py
+++ b/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py
@@ -1,34 +1,8 @@
#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+import gc
import os
import sys
import unittest
@@ -102,6 +76,8 @@ class TestBug(unittest.TestCase):
# instances are destroyed in the correct order.
del view
del app
+ # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
+ gc.collect()
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.qml b/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.qml
index 212166a93..803dec128 100644
--- a/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.qml
+++ b/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
diff --git a/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile_component.qml b/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile_component.qml
index 55dbe144a..0f6693952 100644
--- a/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile_component.qml
+++ b/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile_component.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
diff --git a/sources/pyside6/tests/QtQml/qqmlnetwork_test.py b/sources/pyside6/tests/QtQml/qqmlnetwork_test.py
index 517888c79..abdb4529e 100644
--- a/sources/pyside6/tests/QtQml/qqmlnetwork_test.py
+++ b/sources/pyside6/tests/QtQml/qqmlnetwork_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Test cases for QQmlNetwork'''
@@ -37,18 +12,33 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
-from PySide6.QtCore import QUrl
+from PySide6.QtCore import QUrl, QTimer
+from PySide6.QtGui import QGuiApplication, QWindow
from PySide6.QtQuick import QQuickView
from PySide6.QtQml import QQmlNetworkAccessManagerFactory
from PySide6.QtNetwork import QNetworkAccessManager
from helper.helper import quickview_errorstring
-from helper.timedqapplication import TimedQApplication
+from helper.timedqguiapplication import TimedQGuiApplication
+
+
+request_created = False
+
+
+def check_done():
+ global request_created
+ if request_created:
+ windows = QGuiApplication.topLevelWindows()
+ if windows:
+ windows[0].close()
class CustomManager(QNetworkAccessManager):
+ """CustomManager (running in a different thread)"""
def createRequest(self, op, req, data=None):
+ global request_created
print(">> createRequest ", self, op, req.url(), data)
+ request_created = True
return QNetworkAccessManager.createRequest(self, op, req, data)
@@ -57,9 +47,9 @@ class CustomFactory(QQmlNetworkAccessManagerFactory):
return CustomManager()
-class TestQQmlNetworkFactory(TimedQApplication):
+class TestQQmlNetworkFactory(TimedQGuiApplication):
def setUp(self):
- TimedQApplication.setUp(self, timeout=1000)
+ super().setUp(timeout=2000)
def testQQuickNetworkFactory(self):
view = QQuickView()
@@ -76,6 +66,9 @@ class TestQQmlNetworkFactory(TimedQApplication):
self.assertEqual(view.status(), QQuickView.Ready)
+ timer = QTimer()
+ timer.timeout.connect(check_done)
+ timer.start(50)
self.app.exec()
diff --git a/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py b/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py
index 17b01620b..25341b0b2 100644
--- a/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py
+++ b/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2017 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -36,15 +11,15 @@ from init_paths import init_test_paths
init_test_paths(False)
from helper.helper import quickview_errorstring
-from helper.timedqapplication import TimedQApplication
+from helper.timedqguiapplication import TimedQGuiApplication
from PySide6.QtCore import QTimer, QUrl
from PySide6.QtGui import QColor
from PySide6.QtQuick import QQuickItem, QQuickView
-class TestGrabToSharedPointerImage(TimedQApplication):
+class TestGrabToSharedPointerImage(TimedQGuiApplication):
def setUp(self):
- TimedQApplication.setUp(self, 1000)
+ super().setUp(1000)
def testQQuickItemGrabToImageSharedPointer(self):
view = QQuickView()
@@ -70,7 +45,7 @@ class TestGrabToSharedPointerImage(TimedQApplication):
def onGrabReady():
# Signal early exit.
- QTimer.singleShot(0, self.app.quit)
+ QTimer.singleShot(50, self.app.quit)
# Show the grabbed image in the QML Image item.
imageContainer.setProperty("source", grabResultSharedPtr.url())
diff --git a/sources/pyside6/tests/QtQml/qquickitem_grabToImage.qml b/sources/pyside6/tests/QtQml/qquickitem_grabToImage.qml
index 17d0cbdfe..90235f078 100644
--- a/sources/pyside6/tests/QtQml/qquickitem_grabToImage.qml
+++ b/sources/pyside6/tests/QtQml/qquickitem_grabToImage.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
diff --git a/sources/pyside6/tests/QtQml/qquickview_test.py b/sources/pyside6/tests/QtQml/qquickview_test.py
index 412e6dc2d..226509669 100644
--- a/sources/pyside6/tests/QtQml/qquickview_test.py
+++ b/sources/pyside6/tests/QtQml/qquickview_test.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Test cases for QQuickView'''
@@ -38,15 +13,16 @@ from init_paths import init_test_paths
init_test_paths(False)
from helper.helper import quickview_errorstring
-from helper.timedqapplication import TimedQApplication
+from helper.timedqguiapplication import TimedQGuiApplication
from PySide6.QtCore import QUrl, QObject, Property, Slot, Signal
-from PySide6.QtQml import QQmlEngine
+from PySide6.QtQml import QQmlEngine, QQmlContext
from PySide6.QtQuick import QQuickView
class MyObject(QObject):
titleChanged = Signal()
+
def __init__(self, text, parent=None):
QObject.__init__(self, parent)
self._text = text
@@ -61,7 +37,7 @@ class MyObject(QObject):
title = Property(str, getText, notify=titleChanged)
-class TestQQuickView(TimedQApplication):
+class TestQQuickView(TimedQGuiApplication):
def testQQuickViewList(self):
view = QQuickView()
@@ -84,6 +60,13 @@ class TestQQuickView(TimedQApplication):
self.assertTrue(context)
self.assertTrue(context.engine())
+ test_context = QQmlContext(context) # Context properties, PYSIDE-1921
+ prop_pair = QQmlContext.PropertyPair()
+ prop_pair.name = "testProperty"
+ prop_pair.value = 42
+ test_context.setContextProperties([prop_pair])
+ self.assertTrue(test_context.contextProperty("testProperty"), 42)
+
def testModelExport(self):
view = QQuickView()
dataList = [MyObject("Item 1"), MyObject("Item 2"), MyObject("Item 3"), MyObject("Item 4")]
diff --git a/sources/pyside6/tests/QtQml/registerattached.py b/sources/pyside6/tests/QtQml/registerattached.py
new file mode 100644
index 000000000..dd300dc89
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/registerattached.py
@@ -0,0 +1,101 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import os
+import sys
+import unittest
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from PySide6.QtCore import (QCoreApplication, QUrl, QObject, Property)
+from PySide6.QtQml import (QQmlComponent, QQmlEngine, QmlAnonymous,
+ QmlAttached, QmlElement, ListProperty,
+ qmlAttachedPropertiesObject)
+
+
+QML_IMPORT_NAME = "TestLayouts"
+QML_IMPORT_MAJOR_VERSION = 1
+
+
+EXPECTED_MARGINS = [10, 20]
+
+
+def component_error(component):
+ result = ""
+ for e in component.errors():
+ if result:
+ result += "\n"
+ result += str(e)
+ return result
+
+
+@QmlAnonymous
+class TestLayoutAttached(QObject):
+
+ def __init__(self, parent=None):
+ super().__init__(parent)
+ self._leftMargin = 0
+
+ @Property(int)
+ def leftMargin(self):
+ return self._leftMargin
+
+ @leftMargin.setter
+ def leftMargin(self, m):
+ self._leftMargin = m
+
+
+@QmlElement
+class TestWidget(QObject):
+
+ def __init__(self, parent=None):
+ super().__init__(parent)
+
+
+@QmlElement
+@QmlAttached(TestLayoutAttached)
+class TestLayout(QObject):
+
+ def __init__(self, parent=None):
+ super().__init__(parent)
+ self._widgets = []
+
+ def widget(self, n):
+ return self._widgets[n]
+
+ def widgetCount(self):
+ return len(self._widgets)
+
+ def addWidget(self, w):
+ self._widgets.append(w)
+
+ @staticmethod
+ def qmlAttachedProperties(self, o):
+ return TestLayoutAttached(o)
+
+ widgets = ListProperty(TestWidget, addWidget)
+
+
+class TestQmlAttached(unittest.TestCase):
+ def testIt(self):
+ app = QCoreApplication(sys.argv)
+ file = Path(__file__).resolve().parent / 'registerattached.qml'
+ url = QUrl.fromLocalFile(file)
+ engine = QQmlEngine()
+ component = QQmlComponent(engine, url)
+ layout = component.create()
+ self.assertTrue(layout, component_error(component))
+
+ actual_margins = []
+ for i in range(layout.widgetCount()):
+ w = layout.widget(i)
+ a = qmlAttachedPropertiesObject(TestLayout, w, False)
+ actual_margins.append(a.leftMargin)
+ self.assertEqual(EXPECTED_MARGINS, actual_margins)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside6/tests/QtQml/registerattached.qml b/sources/pyside6/tests/QtQml/registerattached.qml
new file mode 100644
index 000000000..7ae8730bd
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/registerattached.qml
@@ -0,0 +1,20 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import TestLayouts
+
+TestLayout {
+ id: layout
+
+ widgets: [
+ TestWidget {
+ id: widget1
+ TestLayout.leftMargin: 10
+ },
+
+ TestWidget {
+ id: widget2
+ TestLayout.leftMargin: 20
+ }
+ ]
+}
diff --git a/sources/pyside6/tests/QtQml/registerextended.py b/sources/pyside6/tests/QtQml/registerextended.py
new file mode 100644
index 000000000..b87b5aaaf
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/registerextended.py
@@ -0,0 +1,74 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import os
+import sys
+import unittest
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from PySide6.QtCore import (QCoreApplication, QUrl, QObject,
+ Property)
+from PySide6.QtQml import (QQmlComponent, QQmlEngine, QmlExtended,
+ QmlElement)
+
+
+"""Test for the QmlExtended decorator. Extends a class TestWidget
+ by a property leftMargin through a TestExtension and verifies the setting."""
+
+
+QML_IMPORT_NAME = "TestExtension"
+QML_IMPORT_MAJOR_VERSION = 1
+
+
+def component_error(component):
+ result = ""
+ for e in component.errors():
+ if result:
+ result += "\n"
+ result += str(e)
+ return result
+
+
+class TestExtension(QObject):
+
+ def __init__(self, parent=None):
+ super().__init__(parent)
+ self._leftMargin = 0
+
+ @Property(int)
+ def leftMargin(self):
+ return self._leftMargin
+
+ @leftMargin.setter
+ def leftMargin(self, m):
+ self._leftMargin = m
+
+
+@QmlElement
+@QmlExtended(TestExtension)
+class TestWidget(QObject):
+
+ def __init__(self, parent=None):
+ super().__init__(parent)
+
+
+class TestQmlExtended(unittest.TestCase):
+ def testIt(self):
+ app = QCoreApplication(sys.argv)
+ file = Path(__file__).resolve().parent / 'registerextended.qml'
+ url = QUrl.fromLocalFile(file)
+ engine = QQmlEngine()
+ component = QQmlComponent(engine, url)
+ widget = component.create()
+ self.assertTrue(widget, component_error(component))
+ extension = widget.findChild(TestExtension)
+ self.assertTrue(extension)
+ self.assertEqual(extension.leftMargin, 10)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside6/tests/QtQml/registerextended.qml b/sources/pyside6/tests/QtQml/registerextended.qml
new file mode 100644
index 000000000..74095f83f
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/registerextended.qml
@@ -0,0 +1,9 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import TestExtension
+
+TestWidget {
+ id: widget1
+ leftMargin: 10
+}
diff --git a/sources/pyside6/tests/QtQml/registerforeign.py b/sources/pyside6/tests/QtQml/registerforeign.py
new file mode 100644
index 000000000..d9a982d95
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/registerforeign.py
@@ -0,0 +1,52 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import os
+import sys
+import unittest
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from helper.helper import qmlcomponent_errorstring
+from helper.timedqguiapplication import TimedQGuiApplication
+
+from PySide6.QtCore import Property, QObject, QUrl, qVersion
+from PySide6.QtGui import QGuiApplication, QRasterWindow
+from PySide6.QtQml import (QmlNamedElement, QmlForeign, QQmlEngine,
+ QQmlComponent)
+
+
+"""Test the QmlForeign decorator, letting the QQmlEngine create a QRasterWindow."""
+
+
+QML_IMPORT_NAME = "Foreign"
+QML_IMPORT_MAJOR_VERSION = 1
+
+
+@QmlNamedElement("QRasterWindow")
+@QmlForeign(QRasterWindow)
+class RasterWindowForeign(QObject):
+ def __init__(self, parent=None):
+ super().__init__(parent)
+
+
+class TestQmlForeign(TimedQGuiApplication):
+
+ def testIt(self):
+ engine = QQmlEngine()
+ file = Path(__file__).resolve().parent / 'registerforeign.qml'
+ self.assertTrue(file.is_file())
+ component = QQmlComponent(engine, QUrl.fromLocalFile(file))
+ window = component.create()
+ self.assertTrue(window, qmlcomponent_errorstring(component))
+ self.assertEqual(type(window), QRasterWindow)
+ window.setTitle(f"Qt {qVersion()}")
+ window.show()
+ self.app.exec()
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside6/tests/QtQml/registerforeign.qml b/sources/pyside6/tests/QtQml/registerforeign.qml
new file mode 100644
index 000000000..0537abb7c
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/registerforeign.qml
@@ -0,0 +1,8 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import Foreign
+
+QRasterWindow {
+ id: rasterWindow
+}
diff --git a/sources/pyside6/tests/QtQml/registerparserstatus.py b/sources/pyside6/tests/QtQml/registerparserstatus.py
new file mode 100644
index 000000000..bbcc14635
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/registerparserstatus.py
@@ -0,0 +1,60 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import os
+import sys
+import unittest
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from PySide6.QtCore import (QCoreApplication, QUrl)
+from PySide6.QtQml import (QQmlComponent, QQmlEngine,
+ QmlElement, QPyQmlParserStatus)
+
+
+QML_IMPORT_NAME = "ParserStatus"
+QML_IMPORT_MAJOR_VERSION = 1
+
+
+def component_error(component):
+ result = ""
+ for e in component.errors():
+ if result:
+ result += "\n"
+ result += str(e)
+ return result
+
+
+@QmlElement
+class TestItem(QPyQmlParserStatus):
+
+ def __init__(self, parent=None):
+ super().__init__(parent)
+ self.component_complete_called = False
+ self.class_begin_called = False
+
+ def componentComplete(self):
+ self.component_complete_called = True
+
+ def classBegin(self):
+ self.class_begin_called = True
+
+
+class TestQmlAttached(unittest.TestCase):
+ def testIt(self):
+ app = QCoreApplication(sys.argv)
+ file = Path(__file__).resolve().parent / 'registerparserstatus.qml'
+ url = QUrl.fromLocalFile(file)
+ engine = QQmlEngine()
+ component = QQmlComponent(engine, url)
+ item = component.create()
+ self.assertTrue(item, component_error(component))
+ self.assertTrue(item.component_complete_called)
+ self.assertTrue(item.class_begin_called)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside6/tests/QtQml/registerparserstatus.qml b/sources/pyside6/tests/QtQml/registerparserstatus.qml
new file mode 100644
index 000000000..a39f03227
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/registerparserstatus.qml
@@ -0,0 +1,8 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import ParserStatus
+
+TestItem {
+ id: item
+}
diff --git a/sources/pyside6/tests/QtQml/registerqmlfile.py b/sources/pyside6/tests/QtQml/registerqmlfile.py
new file mode 100644
index 000000000..335652e5d
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/registerqmlfile.py
@@ -0,0 +1,30 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import os
+import sys
+import unittest
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from PySide6.QtCore import QDir, QUrl
+from PySide6.QtGui import QGuiApplication
+from PySide6.QtQml import qmlRegisterType
+
+
+class TestQmlSupport(unittest.TestCase):
+
+ def testIt(self):
+ app = QGuiApplication([])
+
+ file = os.fspath(Path(__file__).resolve().parent / 'ModuleType.qml')
+ url = QUrl.fromLocalFile(QDir.fromNativeSeparators(file))
+ result = qmlRegisterType(url, "CustomModule", 1, 0, "ModuleType")
+ self.assertTrue(result != -1)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside6/tests/QtQml/registersingletontype.py b/sources/pyside6/tests/QtQml/registersingletontype.py
index c22f3706e..6beca1131 100644
--- a/sources/pyside6/tests/QtQml/registersingletontype.py
+++ b/sources/pyside6/tests/QtQml/registersingletontype.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2020 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -37,12 +12,18 @@ init_test_paths(False)
from helper.helper import quickview_errorstring
-from PySide6.QtCore import Property, Signal, QTimer, QUrl, QObject
+from PySide6.QtCore import Property, Signal, QTimer, QUrl, QObject, Slot
from PySide6.QtGui import QGuiApplication
-from PySide6.QtQml import qmlRegisterSingletonType, qmlRegisterSingletonInstance
+from PySide6.QtQml import (qmlRegisterSingletonType, qmlRegisterSingletonInstance,
+ QmlElement, QmlSingleton, QJSValue)
from PySide6.QtQuick import QQuickView
+
+URI = "Singletons"
+
+
finalResult = 0
+qObjectQmlTypeId = 0
class SingletonQObject(QObject):
@@ -70,36 +51,102 @@ def singletonQJSValueCallback(engine):
return engine.evaluate("new Object({data: 50})")
+QML_IMPORT_NAME = URI
+QML_IMPORT_MAJOR_VERSION = 1
+
+
+@QmlElement
+@QmlSingleton
+class DecoratedSingletonQObject(QObject):
+ def __init__(self, parent=None):
+ super().__init__(parent)
+ self._data = 200
+
+ def getData(self):
+ return self._data
+
+ def setData(self, data):
+ self._data = data
+
+ data = Property(int, getData, setData)
+
+
+@QmlElement
+@QmlSingleton
+class DecoratedSingletonWithCreate(QObject):
+ def __init__(self, data, parent=None):
+ super().__init__(parent)
+ self._data = data
+
+ @staticmethod
+ def create(engine):
+ return DecoratedSingletonWithCreate(400)
+
+ def getData(self):
+ return self._data
+
+ def setData(self, data):
+ self._data = data
+
+ data = Property(int, getData, setData)
+
+
+class TestQuickView(QQuickView):
+ def __init__(self, parent=None):
+ super().__init__(parent)
+ self._singleton_instance_qobject_int = False
+ self._singleton_instance_qobject_str = False
+ self._singleton_instance_jsvalue_int = False
+
+ @Slot()
+ def testSlot(self):
+ engine = self.engine()
+ instance = engine.singletonInstance(qObjectQmlTypeId)
+ if instance is not None and isinstance(instance, QObject):
+ self._singleton_instance_qobject_int = True
+ instance = engine.singletonInstance(URI, 'SingletonQObjectNoCallback')
+ if instance is not None and isinstance(instance, QObject):
+ self._singleton_instance_qobject_str = True
+ instance = engine.singletonInstance(URI, 'SingletonQJSValue')
+ if instance is not None and isinstance(instance, QJSValue):
+ self._singleton_instance_jsvalue_int = True
+ self.close()
+
+
class TestQmlSupport(unittest.TestCase):
def testIt(self):
app = QGuiApplication([])
- qmlRegisterSingletonType(SingletonQObject, 'Singletons', 1, 0, 'SingletonQObjectNoCallback')
- qmlRegisterSingletonType(SingletonQObject, 'Singletons', 1, 0, 'SingletonQObjectCallback',
+ qObjectQmlTypeId = qmlRegisterSingletonType(SingletonQObject, URI, 1, 0,
+ 'SingletonQObjectNoCallback')
+ qmlRegisterSingletonType(SingletonQObject, URI, 1, 0, 'SingletonQObjectCallback',
singletonQObjectCallback)
- qmlRegisterSingletonType('Singletons', 1, 0, 'SingletonQJSValue', singletonQJSValueCallback)
+ qmlRegisterSingletonType(URI, 1, 0, 'SingletonQJSValue', singletonQJSValueCallback)
# Accepts only QObject derived types
l = [1, 2]
with self.assertRaises(TypeError):
- qmlRegisterSingletonInstance(SingletonQObject, 'Singletons', 1, 0, 'SingletonInstance', l)
+ qmlRegisterSingletonInstance(SingletonQObject, URI, 1, 0, 'SingletonInstance', l)
# Modify value on the instance
s = SingletonQObject()
s.setData(99)
- qmlRegisterSingletonInstance(SingletonQObject, 'Singletons', 1, 0, 'SingletonInstance', s)
+ qmlRegisterSingletonInstance(SingletonQObject, URI, 1, 0, 'SingletonInstance', s)
- view = QQuickView()
+ view = TestQuickView()
file = Path(__file__).resolve().parent / 'registersingletontype.qml'
self.assertTrue(file.is_file())
view.setSource(QUrl.fromLocalFile(file))
self.assertTrue(view.rootObject(), quickview_errorstring(view))
+ view.resize(200, 200)
view.show()
- QTimer.singleShot(250, view.close)
+ QTimer.singleShot(250, view.testSlot)
app.exec()
- self.assertEqual(finalResult, 299)
+ self.assertEqual(finalResult, 899)
+ self.assertTrue(view._singleton_instance_qobject_int)
+ self.assertTrue(view._singleton_instance_qobject_str)
+ self.assertTrue(view._singleton_instance_jsvalue_int)
-if __name__ == '__main__':
- unittest.main()
+if __name__ == '__main__': unittest.main()
diff --git a/sources/pyside6/tests/QtQml/registersingletontype.qml b/sources/pyside6/tests/QtQml/registersingletontype.qml
index 2365cf201..31ca7fe4d 100644
--- a/sources/pyside6/tests/QtQml/registersingletontype.qml
+++ b/sources/pyside6/tests/QtQml/registersingletontype.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
import Singletons 1.0
@@ -33,6 +8,7 @@ Item {
Component.onCompleted: {
SingletonQObjectCallback.data += SingletonQObjectNoCallback.data
+ SingletonQJSValue.data
- + SingletonInstance.data;
+ + SingletonInstance.data
+ + DecoratedSingletonQObject.data + DecoratedSingletonWithCreate.data;
}
}
diff --git a/sources/pyside6/tests/QtQml/registertype.py b/sources/pyside6/tests/QtQml/registertype.py
index 2bfb38d9a..6c9874f32 100644
--- a/sources/pyside6/tests/QtQml/registertype.py
+++ b/sources/pyside6/tests/QtQml/registertype.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -40,7 +15,7 @@ from helper.helper import quickview_errorstring
from PySide6.QtCore import Property, QObject, QTimer, QUrl
from PySide6.QtGui import QGuiApplication, QPen, QColor, QPainter
from PySide6.QtQml import (qjsEngine, qmlContext, qmlEngine, qmlRegisterType,
- ListProperty, QmlElement)
+ ListProperty, QmlElement, QmlNamedElement)
from PySide6.QtQuick import QQuickView, QQuickItem, QQuickPaintedItem
@@ -87,8 +62,8 @@ class PieSlice (QQuickPaintedItem):
paintCalled = True
-@QmlElement
-class PieChart (QQuickItem):
+@QmlNamedElement("PieChart")
+class PieChartOriginalName(QQuickItem):
def __init__(self, parent=None):
QQuickItem.__init__(self, parent)
self._name = ''
diff --git a/sources/pyside6/tests/QtQml/registertype.qml b/sources/pyside6/tests/QtQml/registertype.qml
index c41226016..3be2f9f04 100644
--- a/sources/pyside6/tests/QtQml/registertype.qml
+++ b/sources/pyside6/tests/QtQml/registertype.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
import Charts 1.0
diff --git a/sources/pyside6/tests/QtQml/registeruncreatable.qml b/sources/pyside6/tests/QtQml/registeruncreatable.qml
index bebf68d82..b121c014d 100644
--- a/sources/pyside6/tests/QtQml/registeruncreatable.qml
+++ b/sources/pyside6/tests/QtQml/registeruncreatable.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
import Charts 1.0
diff --git a/sources/pyside6/tests/QtQml/registeruncreatabletype.py b/sources/pyside6/tests/QtQml/registeruncreatabletype.py
index c9c9b3bae..3a4df69f6 100644
--- a/sources/pyside6/tests/QtQml/registeruncreatabletype.py
+++ b/sources/pyside6/tests/QtQml/registeruncreatabletype.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2020 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -39,11 +14,16 @@ from helper.helper import qmlcomponent_errorstring
from PySide6.QtCore import Property, QObject, QUrl
from PySide6.QtGui import QGuiApplication
-from PySide6.QtQml import qmlRegisterUncreatableType, QQmlEngine, QQmlComponent
+from PySide6.QtQml import QmlElement, QmlUncreatable, QQmlEngine, QQmlComponent
noCreationReason = 'Cannot create an item of type: Uncreatable (expected)'
+QML_IMPORT_NAME = "Charts"
+QML_IMPORT_MAJOR_VERSION = 1
+
+@QmlElement
+@QmlUncreatable(noCreationReason)
class Uncreatable(QObject):
def __init__(self, parent=None):
QObject.__init__(self, parent)
@@ -63,9 +43,6 @@ class TestQmlSupport(unittest.TestCase):
def testIt(self):
app = QGuiApplication([])
- self.assertTrue(qmlRegisterUncreatableType(Uncreatable, 'Charts', 1, 0,
- 'Uncreatable', noCreationReason) != -1)
-
engine = QQmlEngine()
file = Path(__file__).resolve().parent / 'registeruncreatable.qml'
self.assertTrue(file.is_file())
diff --git a/sources/pyside6/tests/QtQml/signal_arguments.py b/sources/pyside6/tests/QtQml/signal_arguments.py
index 9ca94cf1e..f5b0f8bd3 100644
--- a/sources/pyside6/tests/QtQml/signal_arguments.py
+++ b/sources/pyside6/tests/QtQml/signal_arguments.py
@@ -1,30 +1,5 @@
-#############################################################################
-##
-## Copyright (C) 2019 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the test suite of Qt for Python.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -36,7 +11,7 @@ from init_paths import init_test_paths
init_test_paths(False)
from helper.helper import quickview_errorstring
-from helper.timedqapplication import TimedQApplication
+from helper.timedqguiapplication import TimedQGuiApplication
from PySide6.QtQuick import QQuickView
from PySide6.QtCore import QObject, Signal, Slot, QUrl, QTimer, Property
@@ -45,6 +20,7 @@ from PySide6.QtQml import QmlElement
QML_IMPORT_NAME = "test.Obj"
QML_IMPORT_MAJOR_VERSION = 1
+
@QmlElement
class Obj(QObject):
def __init__(self):
@@ -62,7 +38,7 @@ class Obj(QObject):
self.value = int(s)
-class TestConnectionWithQml(TimedQApplication):
+class TestConnectionWithQml(TimedQGuiApplication):
def testSignalArguments(self):
view = QQuickView()
diff --git a/sources/pyside6/tests/QtQml/signal_arguments.qml b/sources/pyside6/tests/QtQml/signal_arguments.qml
index 38b96c9b1..dbc991c77 100644
--- a/sources/pyside6/tests/QtQml/signal_arguments.qml
+++ b/sources/pyside6/tests/QtQml/signal_arguments.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.5
diff --git a/sources/pyside6/tests/QtQml/signal_types.py b/sources/pyside6/tests/QtQml/signal_types.py
new file mode 100644
index 000000000..240c0fd6e
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/signal_types.py
@@ -0,0 +1,124 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import json
+import os
+import sys
+import unittest
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from helper.helper import quickview_errorstring
+from helper.timedqguiapplication import TimedQGuiApplication
+
+from PySide6.QtQuick import QQuickView
+from PySide6.QtCore import QObject, Signal, Slot, QUrl
+from PySide6.QtQml import QmlElement
+
+"""PYSIDE-2098: Roundtrip test for signals using QVariantList/QVariantMap.
+
+@QmlElement Obj has signals of list/dict type which are connected to an
+instance of Connections in QML. The QML instance sends them back to Obj's
+slots and additionally sends them back as stringified JSON. This verifies that
+a conversion is done instead of falling back to the default PyObject
+passthrough converter, resulting in a QVariant<PyObject> and reference leaks
+on the PyObject.
+"""
+
+QML_IMPORT_NAME = "test.Obj"
+QML_IMPORT_MAJOR_VERSION = 1
+
+
+@QmlElement
+class Obj(QObject):
+ listSignal = Signal(list)
+ dictSignal = Signal(dict)
+
+ def __init__(self, parent=None):
+ super().__init__(parent)
+ self._last_data = None
+ self._last_json_data = None
+
+ def clear(self):
+ self._last_data = None
+ self._last_json_data = None
+
+ def last_data(self):
+ """Last data received."""
+ return self._last_data
+
+ def last_json_data(self):
+ """Last data converted from JSON."""
+ return self._last_json_data
+
+ def emit_list(self, test_list):
+ self.listSignal.emit(test_list)
+
+ def emit_dict(self, test_dict):
+ self.dictSignal.emit(test_dict)
+
+ @Slot(list)
+ def list_slot(self, l):
+ self._last_data = l
+ print("list_slot", l)
+
+ @Slot(dict)
+ def dict_slot(self, d):
+ self._last_data = d
+ print("dict_slot", d)
+
+ @Slot(str)
+ def json_slot(self, s):
+ self._last_json_data = json.loads(s)
+ print(f'json_slot "{s}"->', self._last_json_data)
+
+
+class TestConnectionWithQml(TimedQGuiApplication):
+
+ def setUp(self):
+ super().setUp()
+ self._view = QQuickView()
+ self._obj = Obj()
+
+ self._view.setInitialProperties({"o": self._obj})
+ file = Path(__file__).resolve().parent / "signal_types.qml"
+ self.assertTrue(file.is_file())
+ self._view.setSource(QUrl.fromLocalFile(file))
+ root = self._view.rootObject()
+ self.assertTrue(root, quickview_errorstring(self._view))
+
+ def tearDown(self):
+ super().tearDown()
+ del self._view
+ self._view = None
+
+ def testVariantList(self):
+ self._obj.clear()
+ test_list = [1, 2]
+ before_refcount = sys.getrefcount(test_list)
+ self._obj.emit_list(test_list)
+ received = self._obj.last_data()
+ self.assertTrue(isinstance(received, list))
+ self.assertEqual(test_list, received)
+ self.assertEqual(test_list, self._obj.last_json_data())
+ refcount = sys.getrefcount(test_list)
+ self.assertEqual(before_refcount, refcount)
+
+ def testVariantDict(self):
+ self._obj.clear()
+ test_dict = {"1": 1, "2": 2}
+ before_refcount = sys.getrefcount(test_dict)
+ self._obj.emit_dict(test_dict)
+ received = self._obj.last_data()
+ self.assertTrue(isinstance(received, dict))
+ self.assertEqual(test_dict, received)
+ self.assertEqual(test_dict, self._obj.last_json_data())
+ refcount = sys.getrefcount(test_dict)
+ self.assertEqual(before_refcount, refcount)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/sources/pyside6/tests/QtQml/signal_types.qml b/sources/pyside6/tests/QtQml/signal_types.qml
new file mode 100644
index 000000000..6b03b3abd
--- /dev/null
+++ b/sources/pyside6/tests/QtQml/signal_types.qml
@@ -0,0 +1,26 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import QtQuick
+import test.Obj
+
+Rectangle {
+ visible: true
+ required property Obj o
+
+ Connections {
+ target: o
+ function onListSignal(list) {
+ var json_data = JSON.stringify(list)
+ console.log("Connections.onListSignal: " + typeof(list) + " " + json_data)
+ o.list_slot(list)
+ o.json_slot(json_data)
+ }
+ function onDictSignal(dict) {
+ var json_data = JSON.stringify(dict)
+ console.log("Connections.onDictSignal: " + typeof(dict) + " " + json_data)
+ o.dict_slot(dict)
+ o.json_slot(json_data)
+ }
+ }
+}
diff --git a/sources/pyside6/tests/QtQml/view.qml b/sources/pyside6/tests/QtQml/view.qml
index 5689366a5..8557271c2 100644
--- a/sources/pyside6/tests/QtQml/view.qml
+++ b/sources/pyside6/tests/QtQml/view.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0
diff --git a/sources/pyside6/tests/QtQml/viewmodel.qml b/sources/pyside6/tests/QtQml/viewmodel.qml
index 5a51ae82b..33db6072e 100644
--- a/sources/pyside6/tests/QtQml/viewmodel.qml
+++ b/sources/pyside6/tests/QtQml/viewmodel.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.0