aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative')
-rw-r--r--examples/declarative/editingmodel/MovingRectangle.qml115
-rw-r--r--examples/declarative/editingmodel/doc/editingmodel.rst14
-rw-r--r--examples/declarative/editingmodel/doc/qabstractlistmodelqml.pngbin45810 -> 0 bytes
-rw-r--r--examples/declarative/editingmodel/main.py58
-rw-r--r--examples/declarative/editingmodel/main.pyproject3
-rw-r--r--examples/declarative/editingmodel/main.qml143
-rw-r--r--examples/declarative/editingmodel/model.py194
-rw-r--r--examples/declarative/extending/chapter1-basics/app.qml64
-rw-r--r--examples/declarative/extending/chapter1-basics/basics.py106
-rw-r--r--examples/declarative/extending/chapter1-basics/chapter1-basics.pyproject3
-rw-r--r--examples/declarative/extending/chapter2-methods/app.qml70
-rw-r--r--examples/declarative/extending/chapter2-methods/chapter2-methods.pyproject3
-rw-r--r--examples/declarative/extending/chapter2-methods/methods.py113
-rw-r--r--examples/declarative/extending/chapter3-bindings/app.qml78
-rw-r--r--examples/declarative/extending/chapter3-bindings/bindings.py117
-rw-r--r--examples/declarative/extending/chapter3-bindings/chapter3-bindings.pyproject3
-rw-r--r--examples/declarative/extending/chapter4-customPropertyTypes/app.qml60
-rw-r--r--examples/declarative/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pyproject3
-rw-r--r--examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py120
-rw-r--r--examples/declarative/extending/chapter5-listproperties/app.qml70
-rw-r--r--examples/declarative/extending/chapter5-listproperties/chapter5-listproperties.pyproject3
-rw-r--r--examples/declarative/extending/chapter5-listproperties/listproperties.py134
-rw-r--r--examples/declarative/objectlistmodel/doc/objectlistmodel.pngbin1327 -> 0 bytes
-rw-r--r--examples/declarative/objectlistmodel/doc/objectlistmodel.rst12
-rw-r--r--examples/declarative/objectlistmodel/objectlistmodel.py99
-rw-r--r--examples/declarative/objectlistmodel/objectlistmodel.pyproject3
-rw-r--r--examples/declarative/objectlistmodel/view.qml52
-rw-r--r--examples/declarative/openglunderqml/doc/openglunderqml.rst21
-rw-r--r--examples/declarative/openglunderqml/doc/squircle.pngbin37963 -> 0 bytes
-rw-r--r--examples/declarative/openglunderqml/main.py64
-rw-r--r--examples/declarative/openglunderqml/main.qml86
-rw-r--r--examples/declarative/openglunderqml/openglunderqml.pyproject3
-rw-r--r--examples/declarative/openglunderqml/squircle.py116
-rw-r--r--examples/declarative/openglunderqml/squirclerenderer.py136
-rw-r--r--examples/declarative/referenceexamples/adding/adding.pyproject5
-rw-r--r--examples/declarative/referenceexamples/adding/doc/adding.rst67
-rw-r--r--examples/declarative/referenceexamples/adding/example.qml56
-rw-r--r--examples/declarative/referenceexamples/adding/main.py67
-rw-r--r--examples/declarative/referenceexamples/adding/person.py72
-rw-r--r--examples/declarative/referenceexamples/coercion/birthdayparty.py78
-rw-r--r--examples/declarative/referenceexamples/coercion/coercion.pyproject3
-rw-r--r--examples/declarative/referenceexamples/coercion/doc/coercion.rst35
-rw-r--r--examples/declarative/referenceexamples/coercion/example.qml63
-rw-r--r--examples/declarative/referenceexamples/coercion/main.py73
-rw-r--r--examples/declarative/referenceexamples/coercion/person.py84
-rw-r--r--examples/declarative/referenceexamples/default/birthdayparty.py79
-rw-r--r--examples/declarative/referenceexamples/default/default.pyproject3
-rw-r--r--examples/declarative/referenceexamples/default/doc/default.rst30
-rw-r--r--examples/declarative/referenceexamples/default/example.qml62
-rw-r--r--examples/declarative/referenceexamples/default/main.py73
-rw-r--r--examples/declarative/referenceexamples/default/person.py83
-rw-r--r--examples/declarative/referenceexamples/methods/birthdayparty.py84
-rw-r--r--examples/declarative/referenceexamples/methods/doc/methods.rst15
-rw-r--r--examples/declarative/referenceexamples/methods/example.qml66
-rw-r--r--examples/declarative/referenceexamples/methods/main.py69
-rw-r--r--examples/declarative/referenceexamples/methods/methods.pyproject3
-rw-r--r--examples/declarative/referenceexamples/methods/person.py71
-rw-r--r--examples/declarative/referenceexamples/properties/birthdayparty.py78
-rw-r--r--examples/declarative/referenceexamples/properties/doc/properties.rst89
-rw-r--r--examples/declarative/referenceexamples/properties/example.qml63
-rw-r--r--examples/declarative/referenceexamples/properties/main.py71
-rw-r--r--examples/declarative/referenceexamples/properties/person.py72
-rw-r--r--examples/declarative/referenceexamples/properties/properties.pyproject6
-rw-r--r--examples/declarative/rendercontrol/rendercontrol_opengl/cuberenderer.py223
-rw-r--r--examples/declarative/rendercontrol/rendercontrol_opengl/demo.qml208
-rw-r--r--examples/declarative/rendercontrol/rendercontrol_opengl/doc/rendercontrol_opengl.rst5
-rw-r--r--examples/declarative/rendercontrol/rendercontrol_opengl/main.py57
-rw-r--r--examples/declarative/rendercontrol/rendercontrol_opengl/rendercontrol_opengl.pyproject6
-rw-r--r--examples/declarative/rendercontrol/rendercontrol_opengl/window_singlethreaded.py308
-rw-r--r--examples/declarative/signals/pytoqml1/main.py69
-rw-r--r--examples/declarative/signals/pytoqml1/pytoqml1.pyproject3
-rw-r--r--examples/declarative/signals/pytoqml1/view.qml73
-rw-r--r--examples/declarative/signals/pytoqml2/main.py92
-rw-r--r--examples/declarative/signals/pytoqml2/pytoqml2.pyproject3
-rw-r--r--examples/declarative/signals/pytoqml2/view.qml67
-rw-r--r--examples/declarative/signals/qmltopy1/main.py88
-rw-r--r--examples/declarative/signals/qmltopy1/qmltopy1.pyproject3
-rw-r--r--examples/declarative/signals/qmltopy1/view.qml91
-rw-r--r--examples/declarative/signals/qmltopy2/main.py83
-rw-r--r--examples/declarative/signals/qmltopy2/qmltopy2.pyproject3
-rw-r--r--examples/declarative/signals/qmltopy2/view.qml86
-rw-r--r--examples/declarative/signals/qmltopy3/main.py71
-rw-r--r--examples/declarative/signals/qmltopy3/qmltopy3.pyproject3
-rw-r--r--examples/declarative/signals/qmltopy3/view.qml103
-rw-r--r--examples/declarative/signals/qmltopy4/main.py71
-rw-r--r--examples/declarative/signals/qmltopy4/qmltopy4.pyproject3
-rw-r--r--examples/declarative/signals/qmltopy4/view.qml68
-rw-r--r--examples/declarative/stringlistmodel/doc/stringlistmodel.pngbin1978 -> 0 bytes
-rw-r--r--examples/declarative/stringlistmodel/doc/stringlistmodel.rst9
-rw-r--r--examples/declarative/stringlistmodel/stringlistmodel.py64
-rw-r--r--examples/declarative/stringlistmodel/stringlistmodel.pyproject3
-rw-r--r--examples/declarative/stringlistmodel/view.qml54
-rw-r--r--examples/declarative/textproperties/doc/textproperties.pngbin14082 -> 0 bytes
-rw-r--r--examples/declarative/textproperties/doc/textproperties.rst9
-rw-r--r--examples/declarative/textproperties/main.py113
-rw-r--r--examples/declarative/textproperties/textproperties.pyproject3
-rw-r--r--examples/declarative/textproperties/view.qml197
-rw-r--r--examples/declarative/usingmodel/doc/usingmodel.pngbin2791 -> 0 bytes
-rw-r--r--examples/declarative/usingmodel/doc/usingmodel.rst9
-rw-r--r--examples/declarative/usingmodel/usingmodel.py108
-rw-r--r--examples/declarative/usingmodel/usingmodel.pyproject3
-rw-r--r--examples/declarative/usingmodel/view.qml66
102 files changed, 0 insertions, 6111 deletions
diff --git a/examples/declarative/editingmodel/MovingRectangle.qml b/examples/declarative/editingmodel/MovingRectangle.qml
deleted file mode 100644
index 0d835af1c..000000000
--- a/examples/declarative/editingmodel/MovingRectangle.qml
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-import QtQuick
-import QtQuick.Controls
-
-Rectangle {
- id: root
- property int modelIndex
- property Item dragParent
- property Item sizeParent
- property alias text: zone.text
- property alias bgColor: root.color
-
- anchors {
- horizontalCenter: parent.horizontalCenter
- verticalCenter: parent.verticalCenter
- }
- color: backgroundColor
- anchors.fill: sizeParent
- border.color: "yellow"
- border.width: 0
- TextArea {
- id: zone
- anchors.centerIn: parent
- text: display
- onTextChanged: model.edit = text
- }
-
- MouseArea {
- id: zoneMouseArea
- anchors.fill: parent
-
- acceptedButtons: Qt.MiddleButton
- onClicked: function(mouse) {
- if (mouse.button == Qt.MiddleButton)
- lv.model.remove(index)
- else
- mouse.accepted = false
- }
- }
- DragHandler {
- id: dragHandler
- xAxis {
-
- enabled: true
- minimum: 0
- maximum: lv.width - droparea.width
- }
- yAxis.enabled: false
- acceptedButtons: Qt.LeftButton
- }
- Drag.active: dragHandler.active
- Drag.source: root
- Drag.hotSpot.x: width / 2
-
- states: [
- State {
- when: dragHandler.active
- ParentChange {
- target: root
- parent: root.dragParent
- }
-
- AnchorChanges {
- target: root
- anchors.horizontalCenter: undefined
- anchors.verticalCenter: undefined
- }
- PropertyChanges {
- target: root
- opacity: 0.6
- border.width: 3
- }
- }
- ]
-}
diff --git a/examples/declarative/editingmodel/doc/editingmodel.rst b/examples/declarative/editingmodel/doc/editingmodel.rst
deleted file mode 100644
index d76bebc22..000000000
--- a/examples/declarative/editingmodel/doc/editingmodel.rst
+++ /dev/null
@@ -1,14 +0,0 @@
-QAbstractListModel in QML
-=========================
-
-This example shows how to add, remove and move items inside a QML
-ListView, but showing and editing the data via roles using a
-QAbstractListModel from Python.
-
-You can add new elements and reset the view using the two top buttons,
-remove elements by 'middle click' the element, and move the elements
-with a 'left click' plus dragging the item around.
-
-.. image:: qabstractlistmodelqml.png
- :width: 400
- :alt: QAbstractListModel/ListView Screenshot
diff --git a/examples/declarative/editingmodel/doc/qabstractlistmodelqml.png b/examples/declarative/editingmodel/doc/qabstractlistmodelqml.png
deleted file mode 100644
index 6e181fba1..000000000
--- a/examples/declarative/editingmodel/doc/qabstractlistmodelqml.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/editingmodel/main.py b/examples/declarative/editingmodel/main.py
deleted file mode 100644
index 34fcadc40..000000000
--- a/examples/declarative/editingmodel/main.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import sys
-from pathlib import Path
-
-from PySide6.QtCore import QUrl
-from PySide6.QtGui import QGuiApplication
-from PySide6.QtQml import QQmlApplicationEngine
-
-from model import BaseModel
-
-if __name__ == "__main__":
- app = QGuiApplication(sys.argv)
- engine = QQmlApplicationEngine()
- qml_file = Path(__file__).parent / "main.qml"
- engine.load(QUrl.fromLocalFile(qml_file))
-
- if not engine.rootObjects():
- sys.exit(-1)
- sys.exit(app.exec())
diff --git a/examples/declarative/editingmodel/main.pyproject b/examples/declarative/editingmodel/main.pyproject
deleted file mode 100644
index 71272a973..000000000
--- a/examples/declarative/editingmodel/main.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["model.py","main.qml","main.py","MovingRectangle.qml"]
-}
diff --git a/examples/declarative/editingmodel/main.qml b/examples/declarative/editingmodel/main.qml
deleted file mode 100644
index 8624be6cf..000000000
--- a/examples/declarative/editingmodel/main.qml
+++ /dev/null
@@ -1,143 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick
-import QtQuick.Controls
-import QtQuick.Window
-import BaseModel
-
-Window {
- title: "Moving Rectangle"
- width: 800
- height: 480
- visible: true
- id: mainWindow
-
- Column {
- spacing: 20
- anchors.fill: parent
- id: mainColumn
- Text {
- padding: 20
- font.pointSize: 10
- width: 600
- wrapMode: Text.Wrap
- text: "This example shows how to add, remove and move items inside a QML ListView.\n
-It shows and edits data via roles using QAbstractListModel on the Python side.\n
-Use the 'Middle click' on top of a rectangle to remove an item.\n
-'Left click' and drag to move the items."
- }
-
- Button {
- anchors {
- left: mainColumn.left
- right: mainColumn.right
- margins: 30
- }
- text: "Reset view"
- onClicked: lv.model.reset()
- }
-
- Button {
- anchors {
- left: mainColumn.left
- right: mainColumn.right
- margins: 30
- }
- text: "Add element"
- onClicked: lv.model.append()
- }
-
- ListView {
- id: lv
- anchors {
- left: mainColumn.left
- right: mainColumn.right
- margins: 30
- }
-
- height: 200
- model: BaseModel {}
- orientation: ListView.Horizontal
- displaced: Transition {
- NumberAnimation {
- properties: "x,y"
- easing.type: Easing.OutQuad
- }
- }
- delegate: DropArea {
- id: droparea
- width: ratio * lv.width
- height: lv.height
-
- onEntered: function (drag) {
- let dragindex = drag.source.modelIndex
- if (index === dragindex)
- return
- lv.model.move(dragindex, index)
- }
-
- MovingRectangle {
- modelIndex: index
- dragParent: lv
- sizeParent: droparea
- }
- }
-
- MouseArea {
- id: lvMousearea
- anchors.fill: lv
- z: -1
- }
- Rectangle {
- id: lvBackground
- anchors.fill: lv
- anchors.margins: -border.width
- color: "white"
- border.color: "black"
- border.width: 5
- z: -1
- }
- Component.onCompleted: {
- lv.model.reset()
- }
- }
- }
-}
diff --git a/examples/declarative/editingmodel/model.py b/examples/declarative/editingmodel/model.py
deleted file mode 100644
index ae9c59d33..000000000
--- a/examples/declarative/editingmodel/model.py
+++ /dev/null
@@ -1,194 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-
-from PySide6.QtCore import (QAbstractListModel, QByteArray, QModelIndex, Qt,
- Slot)
-from PySide6.QtGui import QColor
-from PySide6.QtQml import QmlElement
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "BaseModel"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlElement
-class BaseModel(QAbstractListModel):
-
- RatioRole = Qt.UserRole + 1
-
- def __init__(self, parent=None):
- super().__init__(parent=parent)
- self.db = []
-
- def rowCount(self, parent=QModelIndex()):
- return len(self.db)
-
- def roleNames(self):
- default = super().roleNames()
- default[self.RatioRole] = QByteArray(b"ratio")
- default[Qt.BackgroundRole] = QByteArray(b"backgroundColor")
- return default
-
- def data(self, index, role: int):
- if not self.db:
- ret = None
- elif not index.isValid():
- ret = None
- elif role == Qt.DisplayRole:
- ret = self.db[index.row()]["text"]
- elif role == Qt.BackgroundRole:
- ret = self.db[index.row()]["bgColor"]
- elif role == self.RatioRole:
- ret = self.db[index.row()]["ratio"]
- else:
- ret = None
- return ret
-
- def setData(self, index, value, role):
- if not index.isValid():
- return False
- if role == Qt.EditRole:
- self.db[index.row()]["text"] = value
- return True
-
- @Slot(result=bool)
- def append(self):
- """Slot to append a row at the end"""
- return self.insertRow(self.rowCount())
-
- def insertRow(self, row):
- """Insert a single row at row"""
- return self.insertRows(row, 0)
-
- def insertRows(self, row: int, count, index=QModelIndex()):
- """Insert n rows (n = 1 + count) at row"""
-
- self.beginInsertRows(QModelIndex(), row, row + count)
-
- # start database work
- if len(self.db):
- newid = max(x["id"] for x in self.db) + 1
- else:
- newid = 1
- for i in range(count + 1): # at least one row
- self.db.insert(
- row, {"id": newid, "text": "new", "bgColor": QColor("purple"), "ratio": 0.2}
- )
- # end database work
- self.endInsertRows()
- return True
-
- @Slot(int, int, result=bool)
- def move(self, source: int, target: int):
- """Slot to move a single row from source to target"""
- return self.moveRow(QModelIndex(), source, QModelIndex(), target)
-
- def moveRow(self, sourceParent, sourceRow, dstParent, dstChild):
- """Move a single row"""
- return self.moveRows(sourceParent, sourceRow, 0, dstParent, dstChild)
-
- def moveRows(self, sourceParent, sourceRow, count, dstParent, dstChild):
- """Move n rows (n=1+ count) from sourceRow to dstChild"""
-
- if sourceRow == dstChild:
- return False
-
- elif sourceRow > dstChild:
- end = dstChild
-
- else:
- end = dstChild + 1
-
- self.beginMoveRows(QModelIndex(), sourceRow, sourceRow + count, QModelIndex(), end)
-
- # start database work
- pops = self.db[sourceRow : sourceRow + count + 1]
- if sourceRow > dstChild:
- self.db = (
- self.db[:dstChild]
- + pops
- + self.db[dstChild:sourceRow]
- + self.db[sourceRow + count + 1 :]
- )
- else:
- start = self.db[:sourceRow]
- middle = self.db[dstChild : dstChild + 1]
- endlist = self.db[dstChild + count + 1 :]
- self.db = start + middle + pops + endlist
- # end database work
-
- self.endMoveRows()
- return True
-
- @Slot(int, result=bool)
- def remove(self, row: int):
- """Slot to remove one row"""
- return self.removeRow(row)
-
- def removeRow(self, row, parent=QModelIndex()):
- """Remove one row at index row"""
- return self.removeRows(row, 0, parent)
-
- def removeRows(self, row: int, count: int, parent=QModelIndex()):
- """Remove n rows (n=1+count) starting at row"""
- self.beginRemoveRows(QModelIndex(), row, row + count)
-
- # start database work
- self.db = self.db[:row] + self.db[row + count + 1 :]
- # end database work
-
- self.endRemoveRows()
- return True
-
- @Slot(result=bool)
- def reset(self):
- self.beginResetModel()
- self.resetInternalData() # should work without calling it ?
- self.endResetModel()
- return True
-
- def resetInternalData(self):
- self.db = [
- {"id": 3, "bgColor": QColor("red"), "ratio": 0.15, "text": "first"},
- {"id": 1, "bgColor": QColor("blue"), "ratio": 0.1, "text": "second"},
- {"id": 2, "bgColor": QColor("green"), "ratio": 0.2, "text": "third"},
- ]
diff --git a/examples/declarative/extending/chapter1-basics/app.qml b/examples/declarative/extending/chapter1-basics/app.qml
deleted file mode 100644
index d51d328c7..000000000
--- a/examples/declarative/extending/chapter1-basics/app.qml
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-//![0]
-import Charts
-import QtQuick
-
-Item {
- width: 300; height: 200
-
- PieChart {
- id: aPieChart
- anchors.centerIn: parent
- width: 100; height: 100
- name: "A simple pie chart"
- color: "red"
- }
-
- Text {
- anchors {
- bottom: parent.bottom;
- horizontalCenter: parent.horizontalCenter;
- bottomMargin: 20
- }
- text: aPieChart.name
- }
-}
-//![0]
diff --git a/examples/declarative/extending/chapter1-basics/basics.py b/examples/declarative/extending/chapter1-basics/basics.py
deleted file mode 100644
index b05695800..000000000
--- a/examples/declarative/extending/chapter1-basics/basics.py
+++ /dev/null
@@ -1,106 +0,0 @@
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-"""PySide6 port of the qml/tutorials/extending-qml/chapter1-basics example from Qt v5.x"""
-
-import os
-from pathlib import Path
-import sys
-
-from PySide6.QtCore import Property, Signal, QUrl
-from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor
-from PySide6.QtQml import QmlElement
-from PySide6.QtQuick import QQuickPaintedItem, QQuickView
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "Charts"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlElement
-class PieChart (QQuickPaintedItem):
-
- nameChanged = Signal()
-
- def __init__(self, parent=None):
- QQuickPaintedItem.__init__(self, parent)
- self._name = u''
- self._color = QColor()
-
- def paint(self, painter):
- pen = QPen(self.color, 2)
- painter.setPen(pen)
- painter.setRenderHints(QPainter.Antialiasing, True)
- painter.drawPie(self.boundingRect().adjusted(1, 1, -1, -1), 90 * 16, 290 * 16)
-
- @Property(QColor)
- def color(self):
- return self._color
-
- @color.setter
- def color(self, value):
- self._color = value
-
- @Property(str, notify=nameChanged)
- def name(self):
- return self._name
-
- @name.setter
- def name(self, value):
- self._name = value
-
-
-if __name__ == '__main__':
- app = QGuiApplication(sys.argv)
-
- view = QQuickView()
- view.setResizeMode(QQuickView.SizeRootObjectToView)
- qml_file = os.fspath(Path(__file__).resolve().parent / 'app.qml')
- view.setSource(QUrl.fromLocalFile(qml_file))
- if view.status() == QQuickView.Error:
- sys.exit(-1)
- view.show()
- res = app.exec()
- # Deleting the view before it goes out of scope is required to make sure all child QML instances
- # are destroyed in the correct order.
- del view
- sys.exit(res)
diff --git a/examples/declarative/extending/chapter1-basics/chapter1-basics.pyproject b/examples/declarative/extending/chapter1-basics/chapter1-basics.pyproject
deleted file mode 100644
index 869556bb8..000000000
--- a/examples/declarative/extending/chapter1-basics/chapter1-basics.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["basics.py", "app.qml"]
-}
diff --git a/examples/declarative/extending/chapter2-methods/app.qml b/examples/declarative/extending/chapter2-methods/app.qml
deleted file mode 100644
index 2fc65ab1a..000000000
--- a/examples/declarative/extending/chapter2-methods/app.qml
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-//![0]
-import Charts
-import QtQuick
-
-Item {
- width: 300; height: 200
-
- PieChart {
- id: aPieChart
- anchors.centerIn: parent
- width: 100; height: 100
- color: "red"
-
- onChartCleared: console.log("The chart has been cleared")
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: aPieChart.clearChart()
- }
-
- Text {
- anchors {
- bottom: parent.bottom;
- horizontalCenter: parent.horizontalCenter;
- bottomMargin: 20
- }
- text: "Click anywhere to clear the chart"
- }
-}
-//![0]
diff --git a/examples/declarative/extending/chapter2-methods/chapter2-methods.pyproject b/examples/declarative/extending/chapter2-methods/chapter2-methods.pyproject
deleted file mode 100644
index cdf33be7f..000000000
--- a/examples/declarative/extending/chapter2-methods/chapter2-methods.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["methods.py", "app.qml"]
-}
diff --git a/examples/declarative/extending/chapter2-methods/methods.py b/examples/declarative/extending/chapter2-methods/methods.py
deleted file mode 100644
index b068cd220..000000000
--- a/examples/declarative/extending/chapter2-methods/methods.py
+++ /dev/null
@@ -1,113 +0,0 @@
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-"""PySide6 port of the qml/tutorials/extending-qml/chapter2-methods example from Qt v5.x"""
-
-import os
-from pathlib import Path
-import sys
-
-from PySide6.QtCore import Property, Signal, Slot, Qt, QUrl
-from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor
-from PySide6.QtQml import QmlElement
-from PySide6.QtQuick import QQuickPaintedItem, QQuickView
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "Charts"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlElement
-class PieChart(QQuickPaintedItem):
-
- chartCleared = Signal()
- nameChanged = Signal()
-
- def __init__(self, parent=None):
- QQuickPaintedItem.__init__(self, parent)
- self._name = u''
- self._color = QColor()
-
- def paint(self, painter):
- pen = QPen(self.color, 2)
- painter.setPen(pen)
- painter.setRenderHints(QPainter.Antialiasing, True)
- painter.drawPie(self.boundingRect().adjusted(1, 1, -1, -1), 90 * 16, 290 * 16)
-
- @Property(QColor)
- def color(self):
- return self._color
-
- @color.setter
- def color(self, value):
- self._color = value
-
- @Property(str, notify=nameChanged)
- def name(self):
- return self._name
-
- @name.setter
- def name(self, value):
- self._name = value
-
- @Slot() # This should be something like @Invokable
- def clearChart(self):
- self.color = Qt.transparent
- self.update()
- self.chartCleared.emit()
-
-
-if __name__ == '__main__':
- app = QGuiApplication(sys.argv)
-
- view = QQuickView()
- view.setResizeMode(QQuickView.SizeRootObjectToView)
- qml_file = os.fspath(Path(__file__).resolve().parent / 'app.qml')
- view.setSource(QUrl.fromLocalFile(qml_file))
- if view.status() == QQuickView.Error:
- sys.exit(-1)
- view.show()
- res = app.exec()
- # Deleting the view before it goes out of scope is required to make sure all child QML instances
- # are destroyed in the correct order.
- del view
- sys.exit(res)
diff --git a/examples/declarative/extending/chapter3-bindings/app.qml b/examples/declarative/extending/chapter3-bindings/app.qml
deleted file mode 100644
index 23c1af14f..000000000
--- a/examples/declarative/extending/chapter3-bindings/app.qml
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-//![0]
-import Charts
-import QtQuick
-
-Item {
- width: 300; height: 200
-
- Row {
- anchors.centerIn: parent
- spacing: 20
-
- PieChart {
- id: chartA
- width: 100; height: 100
- color: "red"
- }
-
- PieChart {
- id: chartB
- width: 100; height: 100
- color: chartA.color
- }
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: { chartA.color = "blue" }
- }
-
- Text {
- anchors {
- bottom: parent.bottom;
- horizontalCenter: parent.horizontalCenter;
- bottomMargin: 20
- }
- text: "Click anywhere to change the chart color"
- }
-}
-//![0]
diff --git a/examples/declarative/extending/chapter3-bindings/bindings.py b/examples/declarative/extending/chapter3-bindings/bindings.py
deleted file mode 100644
index 17394d6ea..000000000
--- a/examples/declarative/extending/chapter3-bindings/bindings.py
+++ /dev/null
@@ -1,117 +0,0 @@
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-"""PySide6 port of the qml/tutorials/extending-qml/chapter3-bindings example from Qt v5.x"""
-
-import os
-from pathlib import Path
-import sys
-
-from PySide6.QtCore import Property, Signal, Slot, QUrl, Qt
-from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor
-from PySide6.QtQml import QmlElement
-from PySide6.QtQuick import QQuickPaintedItem, QQuickView
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "Charts"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlElement
-class PieChart (QQuickPaintedItem):
-
- chartCleared = Signal()
- nameChanged = Signal()
- colorChanged = Signal()
-
- def __init__(self, parent=None):
- QQuickPaintedItem.__init__(self, parent)
- self._name = u''
- self._color = QColor()
-
- def paint(self, painter):
- pen = QPen(self._color, 2)
- painter.setPen(pen)
- painter.setRenderHints(QPainter.Antialiasing, True)
- painter.drawPie(self.boundingRect().adjusted(1, 1, -1, -1), 90 * 16, 290 * 16)
-
- @Property(QColor, notify=colorChanged)
- def color(self):
- return self._color
-
- @color.setter
- def color(self, value):
- if value != self._color:
- self._color = value
- self.update()
- self.colorChanged.emit()
-
- @Property(str, notify=nameChanged)
- def name(self):
- return self._name
-
- @name.setter
- def name(self, value):
- self._name = value
-
- @Slot() # This should be something like @Invokable
- def clearChart(self):
- self.color = Qt.transparent
- self.update()
- self.chartCleared.emit()
-
-
-if __name__ == '__main__':
- app = QGuiApplication(sys.argv)
-
- view = QQuickView()
- view.setResizeMode(QQuickView.SizeRootObjectToView)
- qml_file = os.fspath(Path(__file__).resolve().parent / 'app.qml')
- view.setSource(QUrl.fromLocalFile(qml_file))
- if view.status() == QQuickView.Error:
- sys.exit(-1)
- view.show()
- res = app.exec()
- # Deleting the view before it goes out of scope is required to make sure all child QML instances
- # are destroyed in the correct order.
- del view
- sys.exit(res)
diff --git a/examples/declarative/extending/chapter3-bindings/chapter3-bindings.pyproject b/examples/declarative/extending/chapter3-bindings/chapter3-bindings.pyproject
deleted file mode 100644
index 6e21f86f9..000000000
--- a/examples/declarative/extending/chapter3-bindings/chapter3-bindings.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["app.qml", "bindings.py"]
-}
diff --git a/examples/declarative/extending/chapter4-customPropertyTypes/app.qml b/examples/declarative/extending/chapter4-customPropertyTypes/app.qml
deleted file mode 100644
index af98a4055..000000000
--- a/examples/declarative/extending/chapter4-customPropertyTypes/app.qml
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-//![0]
-import Charts
-import QtQuick
-
-Item {
- width: 300; height: 200
-
- PieChart {
- id: chart
- anchors.centerIn: parent
- width: 100; height: 100
-
- pieSlice: PieSlice {
- anchors.fill: parent
- color: "red"
- }
- }
-
- Component.onCompleted: console.log("The pie is colored " + chart.pieSlice.color)
-}
-//![0]
diff --git a/examples/declarative/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pyproject b/examples/declarative/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pyproject
deleted file mode 100644
index af1cfefb7..000000000
--- a/examples/declarative/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["app.qml", "customPropertyTypes.py"]
-}
diff --git a/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py b/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py
deleted file mode 100644
index ce8fd4294..000000000
--- a/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py
+++ /dev/null
@@ -1,120 +0,0 @@
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-"""PySide6 port of the qml/tutorials/extending-qml/chapter4-customPropertyTypes example from Qt v5.x"""
-
-import os
-from pathlib import Path
-import sys
-
-from PySide6.QtCore import Property, QUrl
-from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor
-from PySide6.QtQml import QmlElement
-from PySide6.QtQuick import QQuickPaintedItem, QQuickView, QQuickItem
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "Charts"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlElement
-class PieSlice (QQuickPaintedItem):
-
- def __init__(self, parent=None):
- QQuickPaintedItem.__init__(self, parent)
- self._color = QColor()
-
- @Property(QColor)
- def color(self):
- return self._color
-
- @color.setter
- def color(self, value):
- self._color = value
-
- def paint(self, painter):
- pen = QPen(self._color, 2)
- painter.setPen(pen)
- painter.setRenderHints(QPainter.Antialiasing, True)
- painter.drawPie(self.boundingRect().adjusted(1, 1, -1, -1), 90 * 16, 290 * 16)
-
-
-@QmlElement
-class PieChart (QQuickItem):
- def __init__(self, parent=None):
- QQuickItem.__init__(self, parent)
- self._name = None
- self._pieSlice = None
-
- @Property(str)
- def name(self):
- return self._name
-
- @name.setter
- def name(self, value):
- self._name = value
-
- @Property(PieSlice)
- def pieSlice(self):
- return self._pieSlice
-
- @pieSlice.setter
- def pieSlice(self, value):
- self._pieSlice = value
- self._pieSlice.setParentItem(self)
-
-
-if __name__ == '__main__':
- app = QGuiApplication(sys.argv)
-
- view = QQuickView()
- view.setResizeMode(QQuickView.SizeRootObjectToView)
- qml_file = os.fspath(Path(__file__).resolve().parent / 'app.qml')
- view.setSource(QUrl.fromLocalFile(qml_file))
- if view.status() == QQuickView.Error:
- sys.exit(-1)
- view.show()
- res = app.exec()
- # Deleting the view before it goes out of scope is required to make sure all child QML instances
- # are destroyed in the correct order.
- del view
- sys.exit(res)
diff --git a/examples/declarative/extending/chapter5-listproperties/app.qml b/examples/declarative/extending/chapter5-listproperties/app.qml
deleted file mode 100644
index 5040fa73a..000000000
--- a/examples/declarative/extending/chapter5-listproperties/app.qml
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-//![0]
-import Charts
-import QtQuick
-
-Item {
- width: 300; height: 200
-
- PieChart {
- anchors.centerIn: parent
- width: 100; height: 100
-
- slices: [
- PieSlice {
- anchors.fill: parent
- color: "red"
- fromAngle: 0; angleSpan: 110
- },
- PieSlice {
- anchors.fill: parent
- color: "black"
- fromAngle: 110; angleSpan: 50
- },
- PieSlice {
- anchors.fill: parent
- color: "blue"
- fromAngle: 160; angleSpan: 100
- }
- ]
- }
-}
-//![0]
diff --git a/examples/declarative/extending/chapter5-listproperties/chapter5-listproperties.pyproject b/examples/declarative/extending/chapter5-listproperties/chapter5-listproperties.pyproject
deleted file mode 100644
index a3f89d575..000000000
--- a/examples/declarative/extending/chapter5-listproperties/chapter5-listproperties.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["app.qml", "listproperties.py"]
-}
diff --git a/examples/declarative/extending/chapter5-listproperties/listproperties.py b/examples/declarative/extending/chapter5-listproperties/listproperties.py
deleted file mode 100644
index 8ea36c11c..000000000
--- a/examples/declarative/extending/chapter5-listproperties/listproperties.py
+++ /dev/null
@@ -1,134 +0,0 @@
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-"""PySide6 port of the qml/tutorials/extending-qml/chapter5-listproperties example from Qt v5.x"""
-
-import os
-from pathlib import Path
-import sys
-
-from PySide6.QtCore import Property, QUrl
-from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor
-from PySide6.QtQml import QmlElement, ListProperty
-from PySide6.QtQuick import QQuickPaintedItem, QQuickView, QQuickItem
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "Charts"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlElement
-class PieSlice (QQuickPaintedItem):
- def __init__(self, parent=None):
- QQuickPaintedItem.__init__(self, parent)
- self._color = QColor()
- self._fromAngle = 0
- self._angleSpan = 0
-
- @Property(QColor)
- def color(self):
- return self._color
-
- @color.setter
- def color(self, value):
- self._color = value
-
- @Property(int)
- def fromAngle(self):
- return self._angle
-
- @fromAngle.setter
- def fromAngle(self, value):
- self._fromAngle = value
-
- @Property(int)
- def angleSpan(self):
- return self._angleSpan
-
- @angleSpan.setter
- def angleSpan(self, value):
- self._angleSpan = value
-
- def paint(self, painter):
- pen = QPen(self._color, 2)
- painter.setPen(pen)
- painter.setRenderHints(QPainter.Antialiasing, True)
- painter.drawPie(self.boundingRect().adjusted(1, 1, -1, -1), self._fromAngle * 16, self._angleSpan * 16)
-
-
-@QmlElement
-class PieChart (QQuickItem):
- def __init__(self, parent=None):
- QQuickItem.__init__(self, parent)
- self._name = u''
- self._slices = []
-
- @Property(str)
- def name(self):
- return self._name
-
- @name.setter
- def name(self, value):
- self._name = value
-
- def appendSlice(self, _slice):
- _slice.setParentItem(self)
- self._slices.append(_slice)
-
- slices = ListProperty(PieSlice, appendSlice)
-
-
-if __name__ == '__main__':
- app = QGuiApplication(sys.argv)
-
- view = QQuickView()
- view.setResizeMode(QQuickView.SizeRootObjectToView)
- qml_file = os.fspath(Path(__file__).resolve().parent / 'app.qml')
- view.setSource(QUrl.fromLocalFile(qml_file))
- if view.status() == QQuickView.Error:
- sys.exit(-1)
- view.show()
- res = app.exec()
- # Deleting the view before it goes out of scope is required to make sure all child QML instances
- # are destroyed in the correct order.
- del view
- sys.exit(res)
diff --git a/examples/declarative/objectlistmodel/doc/objectlistmodel.png b/examples/declarative/objectlistmodel/doc/objectlistmodel.png
deleted file mode 100644
index 416e08a85..000000000
--- a/examples/declarative/objectlistmodel/doc/objectlistmodel.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/objectlistmodel/doc/objectlistmodel.rst b/examples/declarative/objectlistmodel/doc/objectlistmodel.rst
deleted file mode 100644
index d71ee61df..000000000
--- a/examples/declarative/objectlistmodel/doc/objectlistmodel.rst
+++ /dev/null
@@ -1,12 +0,0 @@
-Object List Model Example
-=========================
-
-A list of QObject values can also be used as a model.
-A list[QObject,] provides the properties of the objects in the list as roles.
-
-The following application creates a DataObject class with Property values
-that will be accessible as named roles when a list[DataObject,] is exposed to QML:
-
-.. image:: objectlistmodel.png
- :width: 400
- :alt: Object List Model Screenshot
diff --git a/examples/declarative/objectlistmodel/objectlistmodel.py b/examples/declarative/objectlistmodel/objectlistmodel.py
deleted file mode 100644
index 0a3d5501e..000000000
--- a/examples/declarative/objectlistmodel/objectlistmodel.py
+++ /dev/null
@@ -1,99 +0,0 @@
-
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from pathlib import Path
-import sys
-from PySide6.QtCore import QObject, QUrl, Property, Signal
-from PySide6.QtGui import QGuiApplication
-from PySide6.QtQuick import QQuickView
-
-# This example illustrates exposing a list of QObjects as a model in QML
-
-class DataObject(QObject):
-
- nameChanged = Signal()
- colorChanged = Signal()
-
- def __init__(self, name, color, parent=None):
- super().__init__(parent)
- self._name = name
- self._color = color
-
- def name(self):
- return self._name
-
- def setName(self, name):
- if name != self._name:
- self._name = name
- nameChanged.emit()
-
- def color(self):
- return self._color
-
- def setColor(self, color):
- if color != self._color:
- self._color = color
- colorChanged.emit()
-
-
- name = Property(str, name, setName, notify=nameChanged)
- color = Property(str, color, setColor, notify=colorChanged)
-
-
-if __name__ == '__main__':
- app = QGuiApplication(sys.argv)
-
- dataList = [DataObject("Item 1", "red"),
- DataObject("Item 2", "green"),
- DataObject("Item 3", "blue"),
- DataObject("Item 4", "yellow")]
-
- view = QQuickView()
- view.setResizeMode(QQuickView.SizeRootObjectToView)
- view.setInitialProperties({"model": dataList})
-
- qml_file = Path(__file__).parent / "view.qml"
- view.setSource(QUrl.fromLocalFile(qml_file))
- view.show()
-
- r = app.exec()
- del view
- sys.exit(r)
diff --git a/examples/declarative/objectlistmodel/objectlistmodel.pyproject b/examples/declarative/objectlistmodel/objectlistmodel.pyproject
deleted file mode 100644
index 556e399f4..000000000
--- a/examples/declarative/objectlistmodel/objectlistmodel.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["objectlistmodel.py", "view.qml"]
-}
diff --git a/examples/declarative/objectlistmodel/view.qml b/examples/declarative/objectlistmodel/view.qml
deleted file mode 100644
index f796561a5..000000000
--- a/examples/declarative/objectlistmodel/view.qml
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick
-
-ListView {
- width: 100; height: 100
-
- delegate: Rectangle {
- color: model.modelData.color
- height: 25
- width: 100
- Text { text: model.modelData.name }
- }
-}
diff --git a/examples/declarative/openglunderqml/doc/openglunderqml.rst b/examples/declarative/openglunderqml/doc/openglunderqml.rst
deleted file mode 100644
index 6a89a99d9..000000000
--- a/examples/declarative/openglunderqml/doc/openglunderqml.rst
+++ /dev/null
@@ -1,21 +0,0 @@
-OpenGL under QML Squircle
-=========================
-
-The OpenGL under QML example shows how an application can make use of the
-QQuickWindow::beforeRendering() signal to draw custom OpenGL content under a Qt
-Quick scene. This signal is emitted at the start of every frame, before the
-scene graph starts its rendering, thus any OpenGL draw calls that are made as
-a response to this signal, will stack under the Qt Quick items.
-
-As an alternative, applications that wish to render OpenGL content on top of
-the Qt Quick scene, can do so by connecting to the
-QQuickWindow::afterRendering() signal.
-
-In this example, we will also see how it is possible to have values that are
-exposed to QML which affect the OpenGL rendering. We animate the threshold
-value using a NumberAnimation in the QML file and this value is used by the
-OpenGL shader program that draws the squircles.
-
-.. image:: squircle.png
- :width: 400
- :alt: Squircle Screenshot
diff --git a/examples/declarative/openglunderqml/doc/squircle.png b/examples/declarative/openglunderqml/doc/squircle.png
deleted file mode 100644
index c099a6b7e..000000000
--- a/examples/declarative/openglunderqml/doc/squircle.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/openglunderqml/main.py b/examples/declarative/openglunderqml/main.py
deleted file mode 100644
index 2da00fd6b..000000000
--- a/examples/declarative/openglunderqml/main.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import sys
-from pathlib import Path
-
-from PySide6.QtCore import QUrl
-from PySide6.QtGui import QGuiApplication
-from PySide6.QtQuick import QQuickView, QQuickWindow, QSGRendererInterface
-
-from squircle import Squircle
-
-if __name__ == "__main__":
- app = QGuiApplication(sys.argv)
-
- QQuickWindow.setGraphicsApi(QSGRendererInterface.OpenGL)
-
- view = QQuickView()
- view.setResizeMode(QQuickView.SizeRootObjectToView)
- qml_file = Path(__file__).parent / "main.qml"
- view.setSource(QUrl.fromLocalFile(qml_file))
-
- if view.status() == QQuickView.Error:
- sys.exit(-1)
- view.show()
-
- sys.exit(app.exec())
diff --git a/examples/declarative/openglunderqml/main.qml b/examples/declarative/openglunderqml/main.qml
deleted file mode 100644
index 7edcf523b..000000000
--- a/examples/declarative/openglunderqml/main.qml
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick
-import OpenGLUnderQML
-
-Item {
-
- width: 320
- height: 480
-
- Squircle {
- SequentialAnimation on t {
- NumberAnimation { to: 1; duration: 2500; easing.type: Easing.InQuad }
- NumberAnimation { to: 0; duration: 2500; easing.type: Easing.OutQuad }
- loops: Animation.Infinite
- running: true
- }
- }
- Rectangle {
- color: Qt.rgba(1, 1, 1, 0.7)
- radius: 10
- border.width: 1
- border.color: "white"
- anchors.fill: label
- anchors.margins: -10
- }
-
- Text {
- id: label
- color: "black"
- wrapMode: Text.WordWrap
- text: "The background here is a squircle rendered with raw OpenGL using the 'beforeRender()' signal in QQuickWindow. This text label and its border is rendered using QML"
- anchors.right: parent.right
- anchors.left: parent.left
- anchors.bottom: parent.bottom
- anchors.margins: 20
- }
-}
diff --git a/examples/declarative/openglunderqml/openglunderqml.pyproject b/examples/declarative/openglunderqml/openglunderqml.pyproject
deleted file mode 100644
index e7cfbc570..000000000
--- a/examples/declarative/openglunderqml/openglunderqml.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": [ "main.py", "main.qml", "squircle.py", "squirclerenderer.py"]
-}
diff --git a/examples/declarative/openglunderqml/squircle.py b/examples/declarative/openglunderqml/squircle.py
deleted file mode 100644
index 4ae21661e..000000000
--- a/examples/declarative/openglunderqml/squircle.py
+++ /dev/null
@@ -1,116 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from PySide6.QtCore import Property, QRunnable, Qt, Signal, Slot
-from PySide6.QtQml import QmlElement
-from PySide6.QtQuick import QQuickItem, QQuickWindow
-
-from squirclerenderer import SquircleRenderer
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "OpenGLUnderQML"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-class CleanupJob(QRunnable):
- def __init__(self, renderer):
- super().__init__()
- self._renderer = renderer
-
- def run(self):
- del self._renderer
-
-
-@QmlElement
-class Squircle(QQuickItem):
-
- tChanged = Signal()
-
- def __init__(self, parent=None):
- super().__init__(parent)
- self._t = 0.0
- self._renderer = None
- self.windowChanged.connect(self.handleWindowChanged)
-
- def t(self):
- return self._t
-
- def setT(self, value):
- if self._t == value:
- return
- self._t = value
- self.tChanged.emit()
- if self.window():
- self.window().update()
-
- @Slot(QQuickWindow)
- def handleWindowChanged(self, win):
- if win:
- win.beforeSynchronizing.connect(self.sync, type=Qt.DirectConnection)
- win.sceneGraphInvalidated.connect(self.cleanup, type=Qt.DirectConnection)
- win.setColor(Qt.black)
- self.sync()
-
- @Slot()
- def cleanup(self):
- del self._renderer
- self._renderer = None
-
- @Slot()
- def sync(self):
- window = self.window()
- if not self._renderer:
- self._renderer = SquircleRenderer()
- window.beforeRendering.connect(self._renderer.init, Qt.DirectConnection)
- window.beforeRenderPassRecording.connect(
- self._renderer.paint, Qt.DirectConnection
- )
- self._renderer.setViewportSize(window.size() * window.devicePixelRatio())
- self._renderer.setT(self._t)
- self._renderer.setWindow(window)
-
- def releaseResources(self):
- self.window().scheduleRenderJob(
- CleanupJob(self._renderer), QQuickWindow.BeforeSynchronizingStage
- )
- self._renderer = None
-
- t = Property(float, t, setT, notify=tChanged)
diff --git a/examples/declarative/openglunderqml/squirclerenderer.py b/examples/declarative/openglunderqml/squirclerenderer.py
deleted file mode 100644
index 9f857f55f..000000000
--- a/examples/declarative/openglunderqml/squirclerenderer.py
+++ /dev/null
@@ -1,136 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from textwrap import dedent
-
-import numpy as np
-from OpenGL.GL import (GL_ARRAY_BUFFER, GL_BLEND, GL_DEPTH_TEST, GL_FLOAT,
- GL_ONE, GL_SRC_ALPHA, GL_TRIANGLE_STRIP)
-from PySide6.QtCore import QSize, Slot
-from PySide6.QtGui import QOpenGLFunctions
-from PySide6.QtOpenGL import (QOpenGLShader, QOpenGLShaderProgram,
- QOpenGLVersionProfile)
-from PySide6.QtQuick import QQuickWindow, QSGRendererInterface
-
-VERTEX_SHADER = dedent(
- """\
- attribute highp vec4 vertices;
- varying highp vec2 coords;
- void main() {
- gl_Position = vertices;
- coords = vertices.xy;
- }
- """
-)
-FRAGMENT_SHADER = dedent(
- """\
- uniform lowp float t;
- varying highp vec2 coords;
- void main() {
- lowp float i = 1. - (pow(abs(coords.x), 4.) + pow(abs(coords.y), 4.));
- i = smoothstep(t - 0.8, t + 0.8, i);
- i = floor(i * 20.) / 20.;
- gl_FragColor = vec4(coords * .5 + .5, i, i);
- }
- """
-)
-
-
-class SquircleRenderer(QOpenGLFunctions):
- def __init__(self):
- QOpenGLFunctions.__init__(self)
- self._viewport_size = QSize()
- self._t = 0.0
- self._program = None
- self._window = QQuickWindow()
-
- def setT(self, t):
- self._t = t
-
- def setViewportSize(self, size):
- self._viewport_size = size
-
- def setWindow(self, window):
- self._window = window
-
- @Slot()
- def init(self):
- if not self._program:
- rif = self._window.rendererInterface()
- assert (rif.graphicsApi() == QSGRendererInterface.OpenGL)
- self.initializeOpenGLFunctions()
- self._program = QOpenGLShaderProgram()
- self._program.addCacheableShaderFromSourceCode(QOpenGLShader.Vertex, VERTEX_SHADER)
- self._program.addCacheableShaderFromSourceCode(QOpenGLShader.Fragment, FRAGMENT_SHADER)
- self._program.bindAttributeLocation("vertices", 0)
- self._program.link()
-
- @Slot()
- def paint(self):
- # Play nice with the RHI. Not strictly needed when the scenegraph uses
- # OpenGL directly.
- self._window.beginExternalCommands()
-
- self._program.bind()
-
- self._program.enableAttributeArray(0)
-
- values = np.array([-1, -1, 1, -1, -1, 1, 1, 1], dtype="single")
-
- # This example relies on (deprecated) client-side pointers for the vertex
- # input. Therefore, we have to make sure no vertex buffer is bound.
- self.glBindBuffer(GL_ARRAY_BUFFER, 0)
-
- self._program.setAttributeArray(0, GL_FLOAT, values, 2)
- self._program.setUniformValue1f("t", self._t)
-
- self.glViewport(0, 0, self._viewport_size.width(), self._viewport_size.height())
-
- self.glDisable(GL_DEPTH_TEST)
-
- self.glEnable(GL_BLEND)
- self.glBlendFunc(GL_SRC_ALPHA, GL_ONE)
-
- self.glDrawArrays(GL_TRIANGLE_STRIP, 0, 4)
-
- self._program.disableAttributeArray(0)
- self._program.release()
-
- self._window.endExternalCommands()
diff --git a/examples/declarative/referenceexamples/adding/adding.pyproject b/examples/declarative/referenceexamples/adding/adding.pyproject
deleted file mode 100644
index 46df4b253..000000000
--- a/examples/declarative/referenceexamples/adding/adding.pyproject
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "files": ["example.qml",
- "main.py",
- "person.py"]
-}
diff --git a/examples/declarative/referenceexamples/adding/doc/adding.rst b/examples/declarative/referenceexamples/adding/doc/adding.rst
deleted file mode 100644
index 55f6105b7..000000000
--- a/examples/declarative/referenceexamples/adding/doc/adding.rst
+++ /dev/null
@@ -1,67 +0,0 @@
-.. _qml-adding-types-example:
-
-Extending QML - Adding Types Example
-====================================
-
-The Adding Types Example shows how to add a new object type, ``Person``, to QML.
-The ``Person`` type can be used from QML like this:
-
-.. code-block:: javascript
-
- import examples.adding.people
-
- Person {
- name: "Bob Jones"
- shoe_size: 12
- }
-
-Declare the Person Class
-------------------------
-
-All QML types map to C++ types. Here we declare a basic C++ Person class
-with the two properties we want accessible on the QML type - name and shoeSize.
-Although in this example we use the same name for the C++ class as the QML
-type, the C++ class can be named differently, or appear in a namespace.
-
-The Person class implementation is quite basic. The property accessors simply
-return members of the object instance.
-
-.. code-block:: python
-
- from PySide6.QtCore import QObject, Property
- from PySide6.QtQml import QmlElement
-
- # To be used on the @QmlElement decorator
- # (QML_IMPORT_MINOR_VERSION is optional)
- QML_IMPORT_NAME = "examples.adding.people"
- QML_IMPORT_MAJOR_VERSION = 1
-
-
- @QmlElement
- class Person(QObject):
- def __init__(self, parent=None):
- super().__init__(parent)
- self._name = ''
- self._shoe_size = 0
-
- @Property(str)
- def name(self):
- return self._name
-
- @name.setter
- def name(self, n):
- self._name = n
-
- @Property(int)
- def shoe_size(self):
- return self._shoe_size
-
- @shoe_size.setter
- def shoe_size(self, s):
- self._shoe_size = s
-
-Running the Example
--------------------
-
-The main.py file in the example includes a simple shell application that
-loads and runs the QML snippet shown at the beginning of this page.
diff --git a/examples/declarative/referenceexamples/adding/example.qml b/examples/declarative/referenceexamples/adding/example.qml
deleted file mode 100644
index e452b2283..000000000
--- a/examples/declarative/referenceexamples/adding/example.qml
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import examples.adding.people
-
-Person {
- name: "Bob Jones"
- shoe_size: 12
-}
diff --git a/examples/declarative/referenceexamples/adding/main.py b/examples/declarative/referenceexamples/adding/main.py
deleted file mode 100644
index ffa10e9d3..000000000
--- a/examples/declarative/referenceexamples/adding/main.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-"""PySide6 port of the qml/examples/qml/referenceexamples/adding example from Qt v6.x"""
-
-from pathlib import Path
-import sys
-
-from PySide6.QtCore import QCoreApplication, QUrl
-from PySide6.QtQml import QQmlComponent, QQmlEngine
-
-from person import Person
-
-
-if __name__ == '__main__':
- app = QCoreApplication(sys.argv)
-
- qml_file = Path(__file__).parent / "example.qml"
- url = QUrl.fromLocalFile(qml_file)
- engine = QQmlEngine()
- component = QQmlComponent(engine, url)
-
- person = component.create()
- if person:
- print(f"The person's name is {person.name}")
- print(f"They wear a {person.shoe_size} sized shoe")
- else:
- print(component.errors())
- del engine
- sys.exit(0)
diff --git a/examples/declarative/referenceexamples/adding/person.py b/examples/declarative/referenceexamples/adding/person.py
deleted file mode 100644
index 23ac5378d..000000000
--- a/examples/declarative/referenceexamples/adding/person.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from PySide6.QtCore import QObject, Property
-from PySide6.QtQml import QmlElement
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "examples.adding.people"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlElement
-class Person(QObject):
- def __init__(self, parent=None):
- super().__init__(parent)
- self._name = ''
- self._shoe_size = 0
-
- @Property(str)
- def name(self):
- return self._name
-
- @name.setter
- def name(self, n):
- self._name = n
-
- @Property(int)
- def shoe_size(self):
- return self._shoe_size
-
- @shoe_size.setter
- def shoe_size(self, s):
- self._shoe_size = s
-
diff --git a/examples/declarative/referenceexamples/coercion/birthdayparty.py b/examples/declarative/referenceexamples/coercion/birthdayparty.py
deleted file mode 100644
index 4db44d703..000000000
--- a/examples/declarative/referenceexamples/coercion/birthdayparty.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from PySide6.QtCore import QObject, Property
-from PySide6.QtQml import QmlElement, ListProperty
-
-from person import Person
-
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "examples.coercion.people"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlElement
-class BirthdayParty(QObject):
-
- def __init__(self, parent=None):
- super().__init__(parent)
- self._host = None
- self._guests = []
-
- @Property(Person)
- def host(self):
- return self._host
-
- @host.setter
- def host(self, h):
- self._host = h
-
- def guest(self, n):
- return self._guests[n]
-
- def guestCount(self):
- return len(self._guests)
-
- def appendGuest(self, guest):
- self._guests.append(guest)
-
- guests = ListProperty(Person, appendGuest)
diff --git a/examples/declarative/referenceexamples/coercion/coercion.pyproject b/examples/declarative/referenceexamples/coercion/coercion.pyproject
deleted file mode 100644
index 3c01c40c2..000000000
--- a/examples/declarative/referenceexamples/coercion/coercion.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["main.py", "birthdayparty.py", "person.py", "example.qml"]
-}
diff --git a/examples/declarative/referenceexamples/coercion/doc/coercion.rst b/examples/declarative/referenceexamples/coercion/doc/coercion.rst
deleted file mode 100644
index 2ccdaeb4f..000000000
--- a/examples/declarative/referenceexamples/coercion/doc/coercion.rst
+++ /dev/null
@@ -1,35 +0,0 @@
-.. _qml-inheritance-and-coercion-example:
-
-Extending QML - Inheritance and Coercion Example
-================================================
-
-This example builds on the :ref:`qml-adding-types-example` and the
-:ref:`qml-object-and-list-property-types-example` .
-
-The Inheritance and Coercion Example shows how to use base classes to assign
-types of more than one type to a property. It specializes the Person type
-developed in the previous examples into two types - a ``Boy`` and a ``Girl``.
-
-Declare Boy and Girl
---------------------
-
-The Person class remains unaltered in this example and the Boy and Girl C++
-classes are trivial extensions of it. The types and their QML name are
-registered with the QML engine.
-
-As an example, the inheritance used here is a little contrived, but in real
-applications it is likely that the two extensions would add additional
-properties or modify the Person classes behavior.
-
-Running the Example
--------------------
-
-The BirthdayParty type has not changed since the previous example. The
-celebrant and guests property still use the People type.
-
-However, as all three types, Person, Boy and Girl, have been registered with the
-QML system, on assignment QML automatically (and type-safely) converts the Boy
-and Girl objects into a Person.
-
-The main.py file in the example includes a simple shell application that
-loads and runs the QML snippet shown below.
diff --git a/examples/declarative/referenceexamples/coercion/example.qml b/examples/declarative/referenceexamples/coercion/example.qml
deleted file mode 100644
index 919fc36c7..000000000
--- a/examples/declarative/referenceexamples/coercion/example.qml
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import examples.coercion.people
-
-BirthdayParty {
- host: Boy {
- name: "Bob Jones"
- shoe_size: 12
- }
- guests: [
- Boy { name: "Leo Hodges" },
- Boy { name: "Jack Smith" },
- Girl { name: "Anne Brown" }
- ]
-}
diff --git a/examples/declarative/referenceexamples/coercion/main.py b/examples/declarative/referenceexamples/coercion/main.py
deleted file mode 100644
index fc945e184..000000000
--- a/examples/declarative/referenceexamples/coercion/main.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-"""PySide6 port of the qml/examples/qml/referenceexamples/coercion example from Qt v6.x"""
-
-from pathlib import Path
-import sys
-
-from PySide6.QtCore import QCoreApplication, QUrl
-from PySide6.QtQml import QQmlComponent, QQmlEngine
-
-from person import Boy, Girl
-from birthdayparty import BirthdayParty
-
-
-app = QCoreApplication(sys.argv)
-qml_file = Path(__file__).parent / "example.qml"
-url = QUrl.fromLocalFile(qml_file)
-engine = QQmlEngine()
-component = QQmlComponent(engine, url)
-party = component.create()
-if not party:
- print(component.errors())
- del engine
- sys.exit(-1)
-host = party.host
-print(f"{host.name} is having a birthday!")
-if isinstance(host, Boy):
- print("He is inviting:")
-else:
- print("She is inviting:")
-for g in range(party.guestCount()):
- name = party.guest(g).name
- print(f" {name}")
-del engine
-sys.exit(0)
diff --git a/examples/declarative/referenceexamples/coercion/person.py b/examples/declarative/referenceexamples/coercion/person.py
deleted file mode 100644
index 3bb7e7248..000000000
--- a/examples/declarative/referenceexamples/coercion/person.py
+++ /dev/null
@@ -1,84 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from PySide6.QtCore import QObject, Property
-from PySide6.QtQml import QmlElement, QmlUncreatable
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "examples.coercion.people"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlElement
-@QmlUncreatable("Person is an abstract base class.")
-class Person(QObject):
- def __init__(self, parent=None):
- super().__init__(parent)
- self._name = ''
- self._shoe_size = 0
-
- @Property(str)
- def name(self):
- return self._name
-
- @name.setter
- def name(self, n):
- self._name = n
-
- @Property(int)
- def shoe_size(self):
- return self._shoe_size
-
- @shoe_size.setter
- def shoe_size(self, s):
- self._shoe_size = s
-
-
-@QmlElement
-class Boy(Person):
- def __init__(self, parent=None):
- super().__init__(parent)
-
-
-@QmlElement
-class Girl(Person):
- def __init__(self, parent=None):
- super().__init__(parent)
diff --git a/examples/declarative/referenceexamples/default/birthdayparty.py b/examples/declarative/referenceexamples/default/birthdayparty.py
deleted file mode 100644
index 3f3fe0894..000000000
--- a/examples/declarative/referenceexamples/default/birthdayparty.py
+++ /dev/null
@@ -1,79 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from PySide6.QtCore import QObject, ClassInfo, Property
-from PySide6.QtQml import QmlElement, ListProperty
-
-from person import Person
-
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "examples.default.people"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlElement
-@ClassInfo(DefaultProperty="guests")
-class BirthdayParty(QObject):
-
- def __init__(self, parent=None):
- super().__init__(parent)
- self._host = None
- self._guests = []
-
- @Property(Person)
- def host(self):
- return self._host
-
- @host.setter
- def host(self, h):
- self._host = h
-
- def guest(self, n):
- return self._guests[n]
-
- def guestCount(self):
- return len(self._guests)
-
- def appendGuest(self, guest):
- self._guests.append(guest)
-
- guests = ListProperty(Person, appendGuest)
diff --git a/examples/declarative/referenceexamples/default/default.pyproject b/examples/declarative/referenceexamples/default/default.pyproject
deleted file mode 100644
index 3c01c40c2..000000000
--- a/examples/declarative/referenceexamples/default/default.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["main.py", "birthdayparty.py", "person.py", "example.qml"]
-}
diff --git a/examples/declarative/referenceexamples/default/doc/default.rst b/examples/declarative/referenceexamples/default/doc/default.rst
deleted file mode 100644
index 1b28519a7..000000000
--- a/examples/declarative/referenceexamples/default/doc/default.rst
+++ /dev/null
@@ -1,30 +0,0 @@
-.. _qml-default-property-example:
-
-Extending QML - Default Property Example
-========================================
-
-This example builds on the :ref:`qml-adding-types-example`,
-the :ref:`qml-object-and-list-property-types-example` and
-the :ref:`qml-inheritance-and-coercion-example`.
-
-The Default Property Example is a minor modification of the
-:ref:`qml-inheritance-and-coercion-example` that simplifies the
-specification of a BirthdayParty through the use of a default property.
-
-Declaring the BirthdayParty Class
----------------------------------
-
-The only difference between this example and the last, is the addition of a
-``DefaultProperty`` class info annotation.
-
-The default property specifies the property to assign to whenever an explicit
-property is not specified, in the case of the BirthdayParty type the guest
-property. It is purely a syntactic simplification, the behavior is identical
-to specifying the property by name, but it can add a more natural feel in many
-situations. The default property must be either an object or list property.
-
-Running the Example
--------------------
-
-The main.py file in the example includes a simple shell application that
-loads and runs the QML snippet shown below.
diff --git a/examples/declarative/referenceexamples/default/example.qml b/examples/declarative/referenceexamples/default/example.qml
deleted file mode 100644
index 763c9727c..000000000
--- a/examples/declarative/referenceexamples/default/example.qml
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import examples.default.people
-
-BirthdayParty {
- host: Boy {
- name: "Bob Jones"
- shoe_size: 12
- }
-
- Boy { name: "Leo Hodges" }
- Boy { name: "Jack Smith" }
- Girl { name: "Anne Brown" }
-}
diff --git a/examples/declarative/referenceexamples/default/main.py b/examples/declarative/referenceexamples/default/main.py
deleted file mode 100644
index a1c4ff91a..000000000
--- a/examples/declarative/referenceexamples/default/main.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-"""PySide6 port of the qml/examples/qml/referenceexamples/default example from Qt v6.x"""
-
-from pathlib import Path
-import sys
-
-from PySide6.QtCore import QCoreApplication, QUrl
-from PySide6.QtQml import QQmlComponent, QQmlEngine
-
-from person import Boy, Girl
-from birthdayparty import BirthdayParty
-
-
-app = QCoreApplication(sys.argv)
-qml_file = Path(__file__).parent / "example.qml"
-url = QUrl.fromLocalFile(qml_file)
-engine = QQmlEngine()
-component = QQmlComponent(engine, url)
-party = component.create()
-if not party:
- print(component.errors())
- del engine
- sys.exit(-1)
-host = party.host
-print(f"{host.name} is having a birthday!")
-if isinstance(host, Boy):
- print("He is inviting:")
-else:
- print("She is inviting:")
-for g in range(party.guestCount()):
- name = party.guest(g).name
- print(f" {name}")
-del engine
-sys.exit(0)
diff --git a/examples/declarative/referenceexamples/default/person.py b/examples/declarative/referenceexamples/default/person.py
deleted file mode 100644
index c66b16690..000000000
--- a/examples/declarative/referenceexamples/default/person.py
+++ /dev/null
@@ -1,83 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from PySide6.QtCore import QObject, Property
-from PySide6.QtQml import QmlAnonymous, QmlElement
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "examples.default.people"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlAnonymous
-class Person(QObject):
- def __init__(self, parent=None):
- super().__init__(parent)
- self._name = ''
- self._shoe_size = 0
-
- @Property(str)
- def name(self):
- return self._name
-
- @name.setter
- def name(self, n):
- self._name = n
-
- @Property(int)
- def shoe_size(self):
- return self._shoe_size
-
- @shoe_size.setter
- def shoe_size(self, s):
- self._shoe_size = s
-
-
-@QmlElement
-class Boy(Person):
- def __init__(self, parent=None):
- super().__init__(parent)
-
-
-@QmlElement
-class Girl(Person):
- def __init__(self, parent=None):
- super().__init__(parent)
diff --git a/examples/declarative/referenceexamples/methods/birthdayparty.py b/examples/declarative/referenceexamples/methods/birthdayparty.py
deleted file mode 100644
index ca60da771..000000000
--- a/examples/declarative/referenceexamples/methods/birthdayparty.py
+++ /dev/null
@@ -1,84 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from PySide6.QtCore import QObject, Property, Slot
-from PySide6.QtQml import QmlElement, ListProperty
-
-from person import Person
-
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "examples.methods.people"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlElement
-class BirthdayParty(QObject):
-
- def __init__(self, parent=None):
- super().__init__(parent)
- self._host = None
- self._guests = []
-
- @Property(Person)
- def host(self):
- return self._host
-
- @host.setter
- def host(self, h):
- self._host = h
-
- def guest(self, n):
- return self._guests[n]
-
- def guestCount(self):
- return len(self._guests)
-
- def appendGuest(self, guest):
- self._guests.append(guest)
-
- @Slot(str)
- def invite(self, name):
- guest = Person(self)
- guest.name = name
- self.appendGuest(guest)
-
- guests = ListProperty(Person, appendGuest)
diff --git a/examples/declarative/referenceexamples/methods/doc/methods.rst b/examples/declarative/referenceexamples/methods/doc/methods.rst
deleted file mode 100644
index bda2ede5a..000000000
--- a/examples/declarative/referenceexamples/methods/doc/methods.rst
+++ /dev/null
@@ -1,15 +0,0 @@
-.. _qml-methods-example:
-
-Extending QML - Methods Example
-===============================
-
-This example builds on the :ref:`qml-adding-types-example`,
-the :ref:`qml-object-and-list-property-types-example` and
-the :ref:`qml-inheritance-and-coercion-example`.
-
-The Methods Example has an additional method in the ``BirthdayParty`` class:
-``invite()``. ``invite()`` is decorated with ``@Slot`` so that it can be
-called from QML.
-
-In ``example.qml``, the ``invite()`` method is called
-in the ``QtQml.Component.completed()`` signal handler.
diff --git a/examples/declarative/referenceexamples/methods/example.qml b/examples/declarative/referenceexamples/methods/example.qml
deleted file mode 100644
index bbbc154ca..000000000
--- a/examples/declarative/referenceexamples/methods/example.qml
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick
-import examples.methods.people
-
-BirthdayParty {
- host: Person {
- name: "Bob Jones"
- shoe_size: 12
- }
- guests: [
- Person { name: "Leo Hodges" },
- Person { name: "Jack Smith" },
- Person { name: "Anne Brown" }
- ]
-
- Component.onCompleted: invite("William Green")
-}
diff --git a/examples/declarative/referenceexamples/methods/main.py b/examples/declarative/referenceexamples/methods/main.py
deleted file mode 100644
index 9dd9086ab..000000000
--- a/examples/declarative/referenceexamples/methods/main.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-"""PySide6 port of the qml/examples/qml/referenceexamples/methods example from Qt v6.x"""
-
-from pathlib import Path
-import sys
-
-from PySide6.QtCore import QCoreApplication, QUrl
-from PySide6.QtQml import QQmlComponent, QQmlEngine
-
-from person import Person
-from birthdayparty import BirthdayParty
-
-
-app = QCoreApplication(sys.argv)
-qml_file = Path(__file__).parent / "example.qml"
-url = QUrl.fromLocalFile(qml_file)
-engine = QQmlEngine()
-component = QQmlComponent(engine, url)
-party = component.create()
-if not party:
- print(component.errors())
- del engine
- sys.exit(-1)
-host = party.host
-print(f"{host.name} is having a birthday!\nThey are inviting:")
-for g in range(party.guestCount()):
- name = party.guest(g).name
- print(f" {name}")
-del engine
-sys.exit(0)
diff --git a/examples/declarative/referenceexamples/methods/methods.pyproject b/examples/declarative/referenceexamples/methods/methods.pyproject
deleted file mode 100644
index 3c01c40c2..000000000
--- a/examples/declarative/referenceexamples/methods/methods.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["main.py", "birthdayparty.py", "person.py", "example.qml"]
-}
diff --git a/examples/declarative/referenceexamples/methods/person.py b/examples/declarative/referenceexamples/methods/person.py
deleted file mode 100644
index 43cdd09e3..000000000
--- a/examples/declarative/referenceexamples/methods/person.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from PySide6.QtCore import QObject, Property
-from PySide6.QtQml import QmlElement
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "examples.methods.people"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlElement
-class Person(QObject):
- def __init__(self, parent=None):
- super().__init__(parent)
- self._name = ''
- self._shoe_size = 0
-
- @Property(str)
- def name(self):
- return self._name
-
- @name.setter
- def name(self, n):
- self._name = n
-
- @Property(int)
- def shoe_size(self):
- return self._shoe_size
-
- @shoe_size.setter
- def shoe_size(self, s):
- self._shoe_size = s
diff --git a/examples/declarative/referenceexamples/properties/birthdayparty.py b/examples/declarative/referenceexamples/properties/birthdayparty.py
deleted file mode 100644
index 9b4a8428d..000000000
--- a/examples/declarative/referenceexamples/properties/birthdayparty.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from PySide6.QtCore import QObject, Property
-from PySide6.QtQml import QmlElement, ListProperty
-
-from person import Person
-
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "examples.properties.people"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlElement
-class BirthdayParty(QObject):
-
- def __init__(self, parent=None):
- super().__init__(parent)
- self._host = None
- self._guests = []
-
- @Property(Person)
- def host(self):
- return self._host
-
- @host.setter
- def host(self, h):
- self._host = h
-
- def guest(self, n):
- return self._guests[n]
-
- def guestCount(self):
- return len(self._guests)
-
- def appendGuest(self, guest):
- self._guests.append(guest)
-
- guests = ListProperty(Person, appendGuest)
diff --git a/examples/declarative/referenceexamples/properties/doc/properties.rst b/examples/declarative/referenceexamples/properties/doc/properties.rst
deleted file mode 100644
index 909434c3c..000000000
--- a/examples/declarative/referenceexamples/properties/doc/properties.rst
+++ /dev/null
@@ -1,89 +0,0 @@
-.. _qml-object-and-list-property-types-example:
-
-Extending QML - Object and List Property Types Example
-======================================================
-
-Exporting C++ Properties.
-
-This example builds on :ref:`qml-adding-types-example`.
-
-The Object and List Property Types example shows how to add object and list
-properties in QML. This example adds a BirthdayParty type that specifies a
-birthday party, consisting of a celebrant and a list of guests. People are
-specified using the People QML type built in the previous example.
-
-import examples.properties.people
-
-.. code-block:: javascript
-
- BirthdayParty {
- host: Person {
- name: "Bob Jones"
- shoe_size: 12
- }
- guests: [
- Person { name: "Leo Hodges" },
- Person { name: "Jack Smith" },
- Person { name: "Anne Brown" }
- ]
- }
-
-Declare the BirthdayParty
--------------------------
-
-The BirthdayParty class is declared like this:
-
-.. code-block:: python
-
- from person import Person
-
-
- # To be used on the @QmlElement decorator
- # (QML_IMPORT_MINOR_VERSION is optional)
- QML_IMPORT_NAME = "examples.properties.people"
- QML_IMPORT_MAJOR_VERSION = 1
-
-
- @QmlElement
- class BirthdayParty(QObject):
-
- def __init__(self, parent=None):
- super().__init__(parent)
- self._host = None
- self._guests = []
-
- @Property(Person)
- def host(self):
- return self._host
-
- @host.setter
- def host(self, h):
- self._host = h
-
- def guest(self, n):
- return self._guests[n]
-
- def guestCount(self):
- return len(self._guests)
-
- def appendGuest(self, guest):
- self._guests.append(guest)
-
- guests = ListProperty(Person, appendGuest)
-
-The class contains a member to store the celebrant object, and also a
-list member storing the Person instances.
-
-In QML, the type of a list properties - and the guests property is a list of
-people - are all of type ListProperty. ListProperty is simple value
-type that contains a set of functions. QML calls these functions
-whenever it needs to read from, write to or otherwise interact with
-the list. In addition to concrete lists like the people list used in this
-example, the use of QQmlListProperty allows for "virtual lists" and other advanced
-scenarios.
-
-Running the Example
--------------------
-
-The main.py file in the example includes a simple shell application that
-loads and runs the QML snippet shown at the beginning of this page.
diff --git a/examples/declarative/referenceexamples/properties/example.qml b/examples/declarative/referenceexamples/properties/example.qml
deleted file mode 100644
index 7e9f42bbf..000000000
--- a/examples/declarative/referenceexamples/properties/example.qml
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import examples.properties.people
-
-BirthdayParty {
- host: Person {
- name: "Bob Jones"
- shoe_size: 12
- }
- guests: [
- Person { name: "Leo Hodges" },
- Person { name: "Jack Smith" },
- Person { name: "Anne Brown" }
- ]
-}
diff --git a/examples/declarative/referenceexamples/properties/main.py b/examples/declarative/referenceexamples/properties/main.py
deleted file mode 100644
index d26747383..000000000
--- a/examples/declarative/referenceexamples/properties/main.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-"""PySide6 port of the qml/examples/qml/referenceexamples/properties example from Qt v6.x"""
-
-from pathlib import Path
-import sys
-
-from PySide6.QtCore import QCoreApplication, QUrl
-from PySide6.QtQml import QQmlComponent, QQmlEngine
-
-from person import Person
-from birthdayparty import BirthdayParty
-
-
-if __name__ == '__main__':
- app = QCoreApplication(sys.argv)
-
- qml_file = Path(__file__).parent / "example.qml"
- url = QUrl.fromLocalFile(qml_file)
- engine = QQmlEngine()
- component = QQmlComponent(engine, url)
-
- party = component.create()
- if party:
- print(f"{party.host} is having a birthday!\nThey are inviting:")
- for g in range(party.guestCount()):
- name = party.guest(g).name
- print(f" {name}")
- else:
- print(component.errors())
-
- del engine
- sys.exit(0)
diff --git a/examples/declarative/referenceexamples/properties/person.py b/examples/declarative/referenceexamples/properties/person.py
deleted file mode 100644
index e08d9ae90..000000000
--- a/examples/declarative/referenceexamples/properties/person.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from PySide6.QtCore import QObject, Property
-from PySide6.QtQml import QmlElement
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "examples.properties.people"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlElement
-class Person(QObject):
- def __init__(self, parent=None):
- super().__init__(parent)
- self._name = ''
- self._shoe_size = 0
-
- @Property(str)
- def name(self):
- return self._name
-
- @name.setter
- def name(self, n):
- self._name = n
-
- @Property(int)
- def shoe_size(self):
- return self._shoe_size
-
- @shoe_size.setter
- def shoe_size(self, s):
- self._shoe_size = s
-
diff --git a/examples/declarative/referenceexamples/properties/properties.pyproject b/examples/declarative/referenceexamples/properties/properties.pyproject
deleted file mode 100644
index 0f5958fc3..000000000
--- a/examples/declarative/referenceexamples/properties/properties.pyproject
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "files": ["example.qml",
- "main.py",
- "person.py",
- "birthdayparty.py"]
-}
diff --git a/examples/declarative/rendercontrol/rendercontrol_opengl/cuberenderer.py b/examples/declarative/rendercontrol/rendercontrol_opengl/cuberenderer.py
deleted file mode 100644
index 90cd78e65..000000000
--- a/examples/declarative/rendercontrol/rendercontrol_opengl/cuberenderer.py
+++ /dev/null
@@ -1,223 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import ctypes
-import numpy
-from OpenGL.GL import (GL_COLOR_BUFFER_BIT, GL_CULL_FACE, GL_CW,
- GL_DEPTH_BUFFER_BIT, GL_DEPTH_TEST, GL_FALSE, GL_FLOAT,
- GL_TEXTURE_2D, GL_TRIANGLES)
-
-from PySide6.QtGui import (QMatrix4x4, QOffscreenSurface, QOpenGLContext,
- QOpenGLFunctions, QWindow)
-from PySide6.QtOpenGL import (QOpenGLBuffer, QOpenGLShader,
- QOpenGLShaderProgram, QOpenGLVertexArrayObject)
-from shiboken6 import VoidPtr
-
-
-VERTEXSHADER_SOURCE = """attribute highp vec4 vertex;
-attribute lowp vec2 coord;
-varying lowp vec2 v_coord;
-uniform highp mat4 matrix;
-void main() {
- v_coord = coord;
- gl_Position = matrix * vertex;
-}
-"""
-
-
-FRAGMENTSHADER_SOURCE = """varying lowp vec2 v_coord;
-uniform sampler2D sampler;
-void main() {
- gl_FragColor = vec4(texture2D(sampler, v_coord).rgb, 1.0);
-}
-"""
-
-
-FLOAT_SIZE = ctypes.sizeof(ctypes.c_float)
-
-
-VERTEXES = numpy.array([-0.5, 0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5,
- 0.5, -0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
- -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, 0.5, -0.5,
- 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, 0.5, -0.5, -0.5,
-
- 0.5, -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, 0.5, -0.5,
- 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, -0.5, 0.5,
- -0.5, 0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5,
- -0.5, -0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5,
-
- 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5,
- -0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5,
- -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5,
- 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5],
- dtype=numpy.float32)
-
-
-TEX_COORDS = numpy.array([0.0, 0.0, 1.0, 1.0, 1.0, 0.0,
- 1.0, 1.0, 0.0, 0.0, 0.0, 1.0,
- 1.0, 1.0, 1.0, 0.0, 0.0, 1.0,
- 0.0, 0.0, 0.0, 1.0, 1.0, 0.0,
-
- 1.0, 1.0, 1.0, 0.0, 0.0, 1.0,
- 0.0, 0.0, 0.0, 1.0, 1.0, 0.0,
- 0.0, 0.0, 1.0, 1.0, 1.0, 0.0,
- 1.0, 1.0, 0.0, 0.0, 0.0, 1.0,
-
- 0.0, 1.0, 1.0, 0.0, 1.0, 1.0,
- 1.0, 0.0, 0.0, 1.0, 0.0, 0.0,
- 1.0, 0.0, 1.0, 1.0, 0.0, 0.0,
- 0.0, 1.0, 0.0, 0.0, 1.0, 1.0], dtype=numpy.float32)
-
-
-class CubeRenderer():
- def __init__(self, offscreenSurface):
- self.m_angle = 0
- self.m_offscreenSurface = offscreenSurface
- self.m_context = None
- self.m_program = None
- self.m_vbo = None
- self.m_vao = None
- self.m_matrixLoc = 0
- self.m_proj = QMatrix4x4()
-
- def __del__(self):
- # Use a temporary offscreen surface to do the cleanup. There may not
- # be a native window surface available anymore at self stage.
- self.m_context.makeCurrent(self.m_offscreenSurface)
- del self.m_program
- del self.m_vbo
- del self.m_vao
- self.m_context.doneCurrent()
-
- def init(self, w, share):
- self.m_context = QOpenGLContext()
- self.m_context.setShareContext(share)
- self.m_context.setFormat(w.requestedFormat())
- self.m_context.create()
- if not self.m_context.makeCurrent(w):
- return
-
- f = self.m_context.functions()
- f.glClearColor(0.0, 0.1, 0.25, 1.0)
- f.glViewport(0, 0, w.width() * w.devicePixelRatio(),
- w.height() * w.devicePixelRatio())
-
- self.m_program = QOpenGLShaderProgram()
- self.m_program.addCacheableShaderFromSourceCode(QOpenGLShader.Vertex,
- VERTEXSHADER_SOURCE)
- self.m_program.addCacheableShaderFromSourceCode(QOpenGLShader.Fragment,
- FRAGMENTSHADER_SOURCE)
- self.m_program.bindAttributeLocation("vertex", 0)
- self.m_program.bindAttributeLocation("coord", 1)
- self.m_program.link()
- self.m_matrixLoc = self.m_program.uniformLocation("matrix")
-
- self.m_vao = QOpenGLVertexArrayObject()
- self.m_vao.create()
- vaoBinder = QOpenGLVertexArrayObject.Binder(self.m_vao)
-
- self.m_vbo = QOpenGLBuffer()
- self.m_vbo.create()
- self.m_vbo.bind()
-
- vertexCount = 36
- self.m_vbo.allocate(FLOAT_SIZE * vertexCount * 5)
- vertex_data = VERTEXES.tobytes()
- tex_coord_data = TEX_COORDS.tobytes()
- self.m_vbo.write(0, VoidPtr(vertex_data),
- FLOAT_SIZE * vertexCount * 3)
- self.m_vbo.write(FLOAT_SIZE * vertexCount * 3,
- VoidPtr(tex_coord_data),
- FLOAT_SIZE * vertexCount * 2)
- self.m_vbo.release()
-
- if self.m_vao.isCreated():
- self.setupVertexAttribs()
-
- def resize(self, w, h):
- self.m_proj.setToIdentity()
- self.m_proj.perspective(45, w / float(h), 0.01, 100.0)
-
- def setupVertexAttribs(self):
- self.m_vbo.bind()
- self.m_program.enableAttributeArray(0)
- self.m_program.enableAttributeArray(1)
- f = self.m_context.functions()
-
- null = VoidPtr(0)
- pointer = VoidPtr(36 * 3 * FLOAT_SIZE)
- f.glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, null)
- f.glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, pointer)
- self.m_vbo.release()
-
- def render(self, w, share, texture):
- if not self.m_context:
- self.init(w, share)
-
- if not self.m_context.makeCurrent(w):
- return
-
- f = self.m_context.functions()
- f.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
-
- if texture:
- f.glBindTexture(GL_TEXTURE_2D, texture)
- f.glFrontFace(GL_CW) # because our cube's vertex data is such
- f.glEnable(GL_CULL_FACE)
- f.glEnable(GL_DEPTH_TEST)
-
- self.m_program.bind()
- vaoBinder = QOpenGLVertexArrayObject.Binder(self.m_vao)
- # If VAOs are not supported, set the vertex attributes every time.
- if not self.m_vao.isCreated():
- self.setupVertexAttribs()
-
- m = QMatrix4x4()
- m.translate(0, 0, -2)
- m.rotate(90, 0, 0, 1)
- m.rotate(self.m_angle, 0.5, 1, 0)
- self.m_angle += 0.5
-
- self.m_program.setUniformValue(self.m_matrixLoc, self.m_proj * m)
-
- # Draw the cube.
- f.glDrawArrays(GL_TRIANGLES, 0, 36)
-
- self.m_context.swapBuffers(w)
diff --git a/examples/declarative/rendercontrol/rendercontrol_opengl/demo.qml b/examples/declarative/rendercontrol/rendercontrol_opengl/demo.qml
deleted file mode 100644
index aeffc7646..000000000
--- a/examples/declarative/rendercontrol/rendercontrol_opengl/demo.qml
+++ /dev/null
@@ -1,208 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Particles 2.0
-
-Rectangle {
- id: root
-
- gradient: Gradient {
- GradientStop { position: 0; color: mouse.pressed ? "lightsteelblue" : "steelblue" }
- GradientStop { position: 1; color: "black" }
- }
-
- Text {
- anchors.centerIn: parent
- text: "Qt Quick in a texture"
- font.pointSize: 40
- color: "white"
-
- SequentialAnimation on rotation {
- PauseAnimation { duration: 2500 }
- NumberAnimation { from: 0; to: 360; duration: 5000; easing.type: Easing.InOutCubic }
- loops: Animation.Infinite
- }
- }
-
- ParticleSystem {
- id: particles
- anchors.fill: parent
-
- ImageParticle {
- id: smoke
- system: particles
- anchors.fill: parent
- groups: ["A", "B"]
- source: "qrc:///particleresources/glowdot.png"
- colorVariation: 0
- color: "#00111111"
- }
- ImageParticle {
- id: flame
- anchors.fill: parent
- system: particles
- groups: ["C", "D"]
- source: "qrc:///particleresources/glowdot.png"
- colorVariation: 0.1
- color: "#00ff400f"
- }
-
- Emitter {
- id: fire
- system: particles
- group: "C"
-
- y: parent.height
- width: parent.width
-
- emitRate: 350
- lifeSpan: 3500
-
- acceleration: PointDirection { y: -17; xVariation: 3 }
- velocity: PointDirection {xVariation: 3}
-
- size: 24
- sizeVariation: 8
- endSize: 4
- }
-
- TrailEmitter {
- id: fireSmoke
- group: "B"
- system: particles
- follow: "C"
- width: root.width
- height: root.height - 68
-
- emitRatePerParticle: 1
- lifeSpan: 2000
-
- velocity: PointDirection {y:-17*6; yVariation: -17; xVariation: 3}
- acceleration: PointDirection {xVariation: 3}
-
- size: 36
- sizeVariation: 8
- endSize: 16
- }
-
- TrailEmitter {
- id: fireballFlame
- anchors.fill: parent
- system: particles
- group: "D"
- follow: "E"
-
- emitRatePerParticle: 120
- lifeSpan: 180
- emitWidth: TrailEmitter.ParticleSize
- emitHeight: TrailEmitter.ParticleSize
- emitShape: EllipseShape{}
-
- size: 16
- sizeVariation: 4
- endSize: 4
- }
-
- TrailEmitter {
- id: fireballSmoke
- anchors.fill: parent
- system: particles
- group: "A"
- follow: "E"
-
- emitRatePerParticle: 128
- lifeSpan: 2400
- emitWidth: TrailEmitter.ParticleSize
- emitHeight: TrailEmitter.ParticleSize
- emitShape: EllipseShape{}
-
- velocity: PointDirection {yVariation: 16; xVariation: 16}
- acceleration: PointDirection {y: -16}
-
- size: 24
- sizeVariation: 8
- endSize: 8
- }
-
- Emitter {
- id: balls
- system: particles
- group: "E"
-
- y: parent.height
- width: parent.width
-
- emitRate: 2
- lifeSpan: 7000
-
- velocity: PointDirection {y:-17*4*2; xVariation: 6*6}
- acceleration: PointDirection {y: 17*2; xVariation: 6*6}
-
- size: 8
- sizeVariation: 4
- }
-
- Turbulence { //A bit of turbulence makes the smoke look better
- anchors.fill: parent
- groups: ["A","B"]
- strength: 32
- system: particles
- }
- }
-
- onWidthChanged: particles.reset()
- onHeightChanged: particles.reset()
-
- MouseArea {
- id: mouse
- anchors.fill: parent
- }
-}
diff --git a/examples/declarative/rendercontrol/rendercontrol_opengl/doc/rendercontrol_opengl.rst b/examples/declarative/rendercontrol/rendercontrol_opengl/doc/rendercontrol_opengl.rst
deleted file mode 100644
index f47567f52..000000000
--- a/examples/declarative/rendercontrol/rendercontrol_opengl/doc/rendercontrol_opengl.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-QQuickRenderControl OpenGL Example
-==================================
-
-The QQuickRenderControl OpenGL Example shows how to render a Qt Quick scene into a
-texture that is then used by a non-Quick based OpenGL renderer.
diff --git a/examples/declarative/rendercontrol/rendercontrol_opengl/main.py b/examples/declarative/rendercontrol/rendercontrol_opengl/main.py
deleted file mode 100644
index 84a857838..000000000
--- a/examples/declarative/rendercontrol/rendercontrol_opengl/main.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import sys
-from PySide6.QtGui import QGuiApplication
-from PySide6.QtQuick import QQuickWindow, QSGRendererInterface
-
-from window_singlethreaded import WindowSingleThreaded
-
-
-if __name__ == "__main__":
- app = QGuiApplication(sys.argv)
- # only functional when Qt Quick is also using OpenGL
- QQuickWindow.setGraphicsApi(QSGRendererInterface.OpenGLRhi)
- window = WindowSingleThreaded()
- window.resize(1024, 768)
- window.show()
- ex = app.exec()
- del window
- sys.exit(ex)
diff --git a/examples/declarative/rendercontrol/rendercontrol_opengl/rendercontrol_opengl.pyproject b/examples/declarative/rendercontrol/rendercontrol_opengl/rendercontrol_opengl.pyproject
deleted file mode 100644
index b2e80ab23..000000000
--- a/examples/declarative/rendercontrol/rendercontrol_opengl/rendercontrol_opengl.pyproject
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "files": ["cuberenderer.py",
- "main.py",
- "window_singlethreaded.py",
- "demo.qml"]
-}
diff --git a/examples/declarative/rendercontrol/rendercontrol_opengl/window_singlethreaded.py b/examples/declarative/rendercontrol/rendercontrol_opengl/window_singlethreaded.py
deleted file mode 100644
index 08b3236a2..000000000
--- a/examples/declarative/rendercontrol/rendercontrol_opengl/window_singlethreaded.py
+++ /dev/null
@@ -1,308 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import numpy
-from pathlib import Path
-import sys
-import weakref
-from OpenGL.GL import (GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_FILTER,
- GL_NEAREST, GL_RGBA, GL_TEXTURE_2D, GL_UNSIGNED_BYTE)
-
-from PySide6.QtGui import (QMatrix4x4, QMouseEvent, QOffscreenSurface,
- QOpenGLContext, QOpenGLFunctions, QScreen, QSurface,
- QSurfaceFormat, QWindow)
-from PySide6.QtOpenGL import (QOpenGLFramebufferObject, QOpenGLTexture,
- QOpenGLShaderProgram, QOpenGLVertexArrayObject,
- QOpenGLBuffer)
-from PySide6.QtQml import QQmlComponent, QQmlEngine
-from PySide6.QtQuick import (QQuickGraphicsDevice,
- QQuickItem, QQuickRenderControl,
- QQuickRenderTarget, QQuickWindow)
-from PySide6.QtCore import QCoreApplication, QTimer, QUrl
-from shiboken6 import VoidPtr
-
-from cuberenderer import CubeRenderer
-
-
-class RenderControl(QQuickRenderControl):
- def __init__(self, window=None):
- super().__init__()
- self._window = window
-
- def renderWindow(self, offset):
- return self._window() # Dereference the weak reference
-
-
-class WindowSingleThreaded(QWindow):
-
- def __init__(self):
- super().__init__()
- self.m_rootItem = None
- self.m_device = None
- self.m_texture_ids = numpy.array([0], dtype=numpy.uint32)
-
- self.m_quickInitialized = False
- self.m_quickReady = False
- self.m_dpr = 0
- self.m_status_conn_id = None
- self.setSurfaceType(QSurface.OpenGLSurface)
-
- format = QSurfaceFormat()
- # Qt Quick may need a depth and stencil buffer. Always make sure these
- # are available.
- format.setDepthBufferSize(16)
- format.setStencilBufferSize(8)
- self.setFormat(format)
-
- self.m_context = QOpenGLContext()
- self.m_context.setFormat(format)
- self.m_context.create()
-
- self.m_offscreenSurface = QOffscreenSurface()
- # Pass m_context.format(), not format. Format does not specify and
- # color buffer sizes, while the context, that has just been created,
- # reports a format that has these values filled in. Pass self to the
- # offscreen surface to make sure it will be compatible with the
- # context's configuration.
- self.m_offscreenSurface.setFormat(self.m_context.format())
- self.m_offscreenSurface.create()
-
- self.m_cubeRenderer = CubeRenderer(self.m_offscreenSurface)
-
- self.m_renderControl = RenderControl(weakref.ref(self))
-
- # Create a QQuickWindow that is associated with out render control.
- # Note that this window never gets created or shown, meaning that
- # will never get an underlying native (platform) window.
- self.m_quickWindow = QQuickWindow(self.m_renderControl)
-
- # Create a QML engine.
- self.m_qmlEngine = QQmlEngine()
- if not self.m_qmlEngine.incubationController():
- c = self.m_quickWindow.incubationController()
- self.m_qmlEngine.setIncubationController(c)
-
- # When Quick says there is a need to render, we will not render
- # immediately. Instead, a timer with a small interval is used
- # to get better performance.
- self.m_updateTimer = QTimer()
- self.m_updateTimer.setSingleShot(True)
- self.m_updateTimer.setInterval(5)
- self.m_updateTimer.timeout.connect(self.render)
-
- # Now hook up the signals. For simplicy we don't differentiate between
- # renderRequested (only render is needed, no sync) and sceneChanged
- # (polish and sync is needed too).
- self.m_quickWindow.sceneGraphInitialized.connect(self.createTexture)
- self.m_quickWindow.sceneGraphInvalidated.connect(self.destroyTexture)
- self.m_renderControl.renderRequested.connect(self.requestUpdate)
- self.m_renderControl.sceneChanged.connect(self.requestUpdate)
-
- # Just recreating the texture on resize is not sufficient, when moving
- # between screens with different devicePixelRatio the QWindow size may
- # remain the same but the texture dimension is to change regardless.
- self.screenChanged.connect(self.handleScreenChange)
-
- def __del__(self):
- # Make sure the context is current while doing cleanup. Note that
- # we use the offscreen surface here because passing 'self' at self
- # point is not safe: the underlying platform window may already be
- # destroyed. To avoid all the trouble, use another surface that is
- # valid for sure.
- self.m_context.makeCurrent(self.m_offscreenSurface)
-
- del self.m_qmlComponent
- del self.m_qmlEngine
- del self.m_quickWindow
- del self.m_renderControl
-
- if self.texture_id():
- self.m_context.functions().glDeleteTextures(1, self.m_texture_ids)
-
- self.m_context.doneCurrent()
-
- def texture_id(self):
- return self.m_texture_ids[0]
-
- def set_texture_id(self, texture_id):
- self.m_texture_ids[0] = texture_id
-
- def createTexture(self):
- # The scene graph has been initialized. It is now time to create a
- # texture and associate it with the QQuickWindow.
- self.m_dpr = self.devicePixelRatio()
- self.m_textureSize = self.size() * self.m_dpr
- f = self.m_context.functions()
- f.glGenTextures(1, self.m_texture_ids)
- f.glBindTexture(GL_TEXTURE_2D, self.texture_id())
-
- f.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
- f.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
- null = VoidPtr(0)
- f.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, self.m_textureSize.width(),
- self.m_textureSize.height(), 0,
- GL_RGBA, GL_UNSIGNED_BYTE, null)
- target = QQuickRenderTarget.fromOpenGLTexture(self.texture_id(),
- self.m_textureSize)
- self.m_quickWindow.setRenderTarget(target)
-
- def destroyTexture(self):
- self.m_context.functions().glDeleteTextures(1, self.m_texture_ids)
- self.set_texture_id(0)
-
- def render(self):
- if not self.m_context.makeCurrent(self.m_offscreenSurface):
- return
-
- # Polish, synchronize and render the next frame (into our texture).
- # In this example everything happens on the same thread and therefore
- # all three steps are performed in succession from here. In a threaded
- # setup the render() call would happen on a separate thread.
- self.m_renderControl.beginFrame()
- self.m_renderControl.polishItems()
- self.m_renderControl.sync()
- self.m_renderControl.render()
- self.m_renderControl.endFrame()
-
- QOpenGLFramebufferObject.bindDefault()
- self.m_context.functions().glFlush()
-
- self.m_quickReady = True
-
- # Get something onto the screen.
- texture_id = self.texture_id() if self.m_quickReady else 0
- self.m_cubeRenderer.render(self, self.m_context, texture_id)
-
- def requestUpdate(self):
- if not self.m_updateTimer.isActive():
- self.m_updateTimer.start()
-
- def run(self):
- if self.m_status_conn_id:
- self.m_qmlComponent.statusChanged.disconnect(self.m_status_conn_id)
- self.m_status_conn_id = None
-
- if self.m_qmlComponent.isError():
- for error in self.m_qmlComponent.errors():
- print(error.url().toString(), error.line(), error.toString())
- return
-
- self.m_rootItem = self.m_qmlComponent.create()
- if self.m_qmlComponent.isError():
- for error in self.m_qmlComponent.errors():
- print(error.url().toString(), error.line(), error.toString())
- return
-
- if not self.m_rootItem:
- print("run: Not a QQuickItem")
- del self.m_rootItem
-
- # The root item is ready. Associate it with the window.
- self.m_rootItem.setParentItem(self.m_quickWindow.contentItem())
-
- # Update item and rendering related geometries.
- self.updateSizes()
-
- # Initialize the render control and our OpenGL resources.
- self.m_context.makeCurrent(self.m_offscreenSurface)
- self.m_device = QQuickGraphicsDevice.fromOpenGLContext(self.m_context)
- self.m_quickWindow.setGraphicsDevice(self.m_device)
- self.m_renderControl.initialize()
- self.m_quickInitialized = True
-
- def updateSizes(self):
- # Behave like SizeRootObjectToView.
- w = self.width()
- h = self.height()
- self.m_rootItem.setWidth(w)
- self.m_rootItem.setHeight(h)
- self.m_quickWindow.setGeometry(0, 0, w, h)
- self.m_cubeRenderer.resize(w, h)
-
- def startQuick(self, filename):
- url = QUrl.fromLocalFile(filename)
- self.m_qmlComponent = QQmlComponent(self.m_qmlEngine, url)
- if self.m_qmlComponent.isLoading():
- self.m_status_conn_id = self.m_qmlComponent.statusChanged.connect(self.run)
- else:
- self.run()
-
- def exposeEvent(self, event):
- if self.isExposed() and not self.m_quickInitialized:
- texture_id = self.texture_id() if self.m_quickReady else 0
- self.m_cubeRenderer.render(self, self.m_context, texture_id)
- qml_file = Path(__file__).parent / "demo.qml"
- self.startQuick(qml_file)
-
- def resizeTexture(self):
- if self.m_rootItem and self.m_context.makeCurrent(self.m_offscreenSurface):
- self.m_context.functions().glDeleteTextures(1, self.m_texture_ids)
- self.set_texture_id(0)
- self.createTexture()
- self.m_context.doneCurrent()
- self.updateSizes()
- self.render()
-
- def resizeEvent(self, event):
- # If self is a resize after the scene is up and running, recreate the
- # texture and the Quick item and scene.
- if (self.texture_id()
- and self.m_textureSize != self.size() * self.devicePixelRatio()):
- self.resizeTexture()
-
- def handleScreenChange(self):
- if self.m_dpr != self.devicePixelRatio():
- self.resizeTexture()
-
- def mousePressEvent(self, e):
- # Use the constructor taking position and globalPosition. That puts
- # position into the event's position and scenePosition, and
- # globalPosition into the event's globalPosition. This way the
- # scenePosition in `e` is ignored and is replaced by position.
- # This is necessary because QQuickWindow thinks of itself as
- # a top-level window always.
- mappedEvent = QMouseEvent(e.type(), e.position(), e.globalPosition(),
- e.button(), e.buttons(), e.modifiers())
- QCoreApplication.sendEvent(self.m_quickWindow, mappedEvent)
-
- def mouseReleaseEvent(self, e):
- mappedEvent = QMouseEvent(e.type(), e.position(), e.globalPosition(),
- e.button(), e.buttons(), e.modifiers())
- QCoreApplication.sendEvent(self.m_quickWindow, mappedEvent)
diff --git a/examples/declarative/signals/pytoqml1/main.py b/examples/declarative/signals/pytoqml1/main.py
deleted file mode 100644
index 3dc18adaf..000000000
--- a/examples/declarative/signals/pytoqml1/main.py
+++ /dev/null
@@ -1,69 +0,0 @@
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-from pathlib import Path
-import sys
-from PySide6.QtCore import QTimer, QUrl
-from PySide6.QtGui import QGuiApplication
-from PySide6.QtQuick import QQuickView
-
-if __name__ == '__main__':
- app = QGuiApplication(sys.argv)
-
- timer = QTimer()
- timer.start(2000)
-
- view = QQuickView()
- qml_file = os.fspath(Path(__file__).resolve().parent / 'view.qml')
- view.setSource(QUrl.fromLocalFile(qml_file))
- if view.status() == QQuickView.Error:
- sys.exit(-1)
- root = view.rootObject()
-
- timer.timeout.connect(root.updateRotater)
-
- view.show()
- res = app.exec()
- # Deleting the view before it goes out of scope is required to make sure all child QML instances
- # are destroyed in the correct order.
- del view
- sys.exit(res)
diff --git a/examples/declarative/signals/pytoqml1/pytoqml1.pyproject b/examples/declarative/signals/pytoqml1/pytoqml1.pyproject
deleted file mode 100644
index e6f087cce..000000000
--- a/examples/declarative/signals/pytoqml1/pytoqml1.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["main.py", "view.qml"]
-}
diff --git a/examples/declarative/signals/pytoqml1/view.qml b/examples/declarative/signals/pytoqml1/view.qml
deleted file mode 100644
index db91d157d..000000000
--- a/examples/declarative/signals/pytoqml1/view.qml
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick
-
-Rectangle {
- id: page
-
- function updateRotater() {
- rotater.angle = rotater.angle + 45
- }
-
- width: 500; height: 200
- color: "lightgray"
-
- Rectangle {
- id: rotater
- property real angle : 0
- x: 240
- width: 100; height: 10
- color: "black"
- y: 95
-
- transform: Rotation {
- origin.x: 10; origin.y: 5
- angle: rotater.angle
- Behavior on angle {
- SpringAnimation {
- spring: 1.4
- damping: .05
- }
- }
- }
- }
-
-}
diff --git a/examples/declarative/signals/pytoqml2/main.py b/examples/declarative/signals/pytoqml2/main.py
deleted file mode 100644
index 31e860dc1..000000000
--- a/examples/declarative/signals/pytoqml2/main.py
+++ /dev/null
@@ -1,92 +0,0 @@
-
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-from pathlib import Path
-import sys
-from PySide6.QtCore import QObject, QTimer, QUrl, Signal, Slot
-from PySide6.QtGui import QGuiApplication
-from PySide6.QtQuick import QQuickView
-from PySide6.QtQml import QmlElement
-
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "examples.signals.pytoqml2"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlElement
-class RotateValue(QObject):
- valueChanged = Signal(int, arguments=['val'])
-
- def __init__(self):
- super().__init__()
- self.r = 0
-
- @Slot()
- def increment(self):
- self.r = self.r + 10
- self.valueChanged.emit(self.r)
-
-
-if __name__ == '__main__':
- app = QGuiApplication(sys.argv)
- view = QQuickView()
-
- rotatevalue = RotateValue()
- timer = QTimer()
- timer.start(2000)
- view.setInitialProperties({"rotatevalue": rotatevalue})
-
- qml_file = os.fspath(Path(__file__).resolve().parent / 'view.qml')
- view.setSource(QUrl.fromLocalFile(qml_file))
- if view.status() == QQuickView.Error:
- sys.exit(-1)
-
- timer.timeout.connect(rotatevalue.increment)
-
- view.show()
- res = app.exec()
- # Deleting the view before it goes out of scope is required to make
- # sure all child QML instances are destroyed in the correct order.
- del view
- sys.exit(res)
diff --git a/examples/declarative/signals/pytoqml2/pytoqml2.pyproject b/examples/declarative/signals/pytoqml2/pytoqml2.pyproject
deleted file mode 100644
index e6f087cce..000000000
--- a/examples/declarative/signals/pytoqml2/pytoqml2.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["main.py", "view.qml"]
-}
diff --git a/examples/declarative/signals/pytoqml2/view.qml b/examples/declarative/signals/pytoqml2/view.qml
deleted file mode 100644
index 7ba0b70b3..000000000
--- a/examples/declarative/signals/pytoqml2/view.qml
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick
-import QtQml
-
-import examples.signals.pytoqml2 1.0
-
-Rectangle {
- id: page
-
- width: 500; height: 200
- color: "lightgray"
- required property RotateValue rotatevalue
-
- Text {
- id: helloText
- text: "Hello world!"
- anchors.horizontalCenter: page.horizontalCenter
- y: 30
- font.pointSize: 24; font.bold: true
- }
-
- Connections {
- target: rotatevalue
- function onValueChanged(val) {
- helloText.rotation = val
- }
- }
-}
diff --git a/examples/declarative/signals/qmltopy1/main.py b/examples/declarative/signals/qmltopy1/main.py
deleted file mode 100644
index b84d98a71..000000000
--- a/examples/declarative/signals/qmltopy1/main.py
+++ /dev/null
@@ -1,88 +0,0 @@
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-from pathlib import Path
-import sys
-from PySide6.QtCore import QObject, QUrl, Slot
-from PySide6.QtGui import QGuiApplication
-from PySide6.QtQuick import QQuickView
-from PySide6.QtQml import QmlElement
-
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "examples.signals.qmltopy1"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlElement
-class Console(QObject):
- """Output stuff on the console."""
-
- @Slot(str)
- @Slot('double')
- def output(self, s):
- print(s)
-
- @Slot(str)
- def outputStr(self, s):
- print(s)
-
- @Slot('double')
- def outputFloat(self, x):
- print(x)
-
-
-if __name__ == '__main__':
- app = QGuiApplication(sys.argv)
- view = QQuickView()
-
- qml_file = os.fspath(Path(__file__).resolve().parent / 'view.qml')
- view.setSource(QUrl.fromLocalFile(qml_file))
- if view.status() == QQuickView.Error:
- sys.exit(-1)
- view.show()
- res = app.exec()
- # Deleting the view before it goes out of scope is required to make sure all child QML instances
- # are destroyed in the correct order.
- del view
- sys.exit(res)
diff --git a/examples/declarative/signals/qmltopy1/qmltopy1.pyproject b/examples/declarative/signals/qmltopy1/qmltopy1.pyproject
deleted file mode 100644
index e6f087cce..000000000
--- a/examples/declarative/signals/qmltopy1/qmltopy1.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["main.py", "view.qml"]
-}
diff --git a/examples/declarative/signals/qmltopy1/view.qml b/examples/declarative/signals/qmltopy1/view.qml
deleted file mode 100644
index 6c2ede5a1..000000000
--- a/examples/declarative/signals/qmltopy1/view.qml
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-import QtQuick
-
-import examples.signals.qmltopy1 1.0
-
-Rectangle {
- id: page
-
- width: 500; height: 200
- color: "lightgray"
-
- Console {
- id: pyConsole
- }
-
- Text {
- id: helloText
- text: "Hello world!"
- anchors.horizontalCenter: page.horizontalCenter
- y: 30
- font.pointSize: 24; font.bold: true
- }
-
- Rectangle {
- id: button
- width: 150; height: 40
- color: "darkgray"
- anchors.horizontalCenter: page.horizontalCenter
- y: 120
- MouseArea {
- id: buttonMouseArea
- objectName: "buttonMouseArea"
- anchors.fill: parent
- onClicked: {
- // once the "console" context has been declared,
- // slots can be called like functions
- pyConsole.outputFloat(123)
- pyConsole.outputStr("foobar")
- pyConsole.output(helloText.x)
- pyConsole.output(helloText.text)
- }
- }
- Text {
- id: buttonText
- text: "Press me!"
- anchors.horizontalCenter: button.horizontalCenter
- anchors.verticalCenter: button.verticalCenter
- font.pointSize: 16
- }
- }
-}
diff --git a/examples/declarative/signals/qmltopy2/main.py b/examples/declarative/signals/qmltopy2/main.py
deleted file mode 100644
index 21addc13b..000000000
--- a/examples/declarative/signals/qmltopy2/main.py
+++ /dev/null
@@ -1,83 +0,0 @@
-
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-from pathlib import Path
-import sys
-from PySide6.QtCore import QObject, QUrl, Slot
-from PySide6.QtGui import QGuiApplication
-from PySide6.QtQuick import QQuickView
-from PySide6.QtQml import QmlElement
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "examples.signals.qmltopy2"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlElement
-class RotateValue(QObject):
- def __init__(self):
- super().__init__()
- self.r = 0
-
- # If a slot returns a value, the return value type must be explicitly
- # defined in the decorator.
- @Slot(result=int)
- def val(self):
- self.r = self.r + 10
- return self.r
-
-
-if __name__ == '__main__':
- app = QGuiApplication(sys.argv)
- view = QQuickView()
-
- qml_file = os.fspath(Path(__file__).resolve().parent / 'view.qml')
- view.setSource(QUrl.fromLocalFile(qml_file))
- if view.status() == QQuickView.Error:
- sys.exit(-1)
- view.show()
- res = app.exec()
- # Deleting the view before it goes out of scope is required to make sure all child QML instances
- # are destroyed in the correct order.
- del view
- sys.exit(res)
diff --git a/examples/declarative/signals/qmltopy2/qmltopy2.pyproject b/examples/declarative/signals/qmltopy2/qmltopy2.pyproject
deleted file mode 100644
index e6f087cce..000000000
--- a/examples/declarative/signals/qmltopy2/qmltopy2.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["main.py", "view.qml"]
-}
diff --git a/examples/declarative/signals/qmltopy2/view.qml b/examples/declarative/signals/qmltopy2/view.qml
deleted file mode 100644
index d27c2f29c..000000000
--- a/examples/declarative/signals/qmltopy2/view.qml
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick
-
-import examples.signals.qmltopy2 1.0
-
-Rectangle {
- id: page
-
- width: 500; height: 200
- color: "lightgray"
-
- RotateValue {
- id: rotatevalue
- }
-
- Text {
- id: helloText
- text: "Hello world!"
- anchors.horizontalCenter: page.horizontalCenter
- y: 30
- font.pointSize: 24; font.bold: true
- }
-
-
- Rectangle {
- id: button
- width: 150; height: 40
- color: "darkgray"
- anchors.horizontalCenter: page.horizontalCenter
- y: 120
- MouseArea {
- id: buttonMouseArea
- objectName: "buttonMouseArea"
- anchors.fill: parent
- onClicked: {
- helloText.rotation = rotatevalue.val()
- }
- }
- Text {
- id: buttonText
- text: "Press me!"
- anchors.horizontalCenter: button.horizontalCenter
- anchors.verticalCenter: button.verticalCenter
- font.pointSize: 16
- }
- }
-}
diff --git a/examples/declarative/signals/qmltopy3/main.py b/examples/declarative/signals/qmltopy3/main.py
deleted file mode 100644
index 0f6523125..000000000
--- a/examples/declarative/signals/qmltopy3/main.py
+++ /dev/null
@@ -1,71 +0,0 @@
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-from pathlib import Path
-import sys
-from PySide6.QtCore import QUrl
-from PySide6.QtGui import QGuiApplication
-from PySide6.QtQuick import QQuickView
-
-
-def sayThis(s):
- print(s)
-
-
-if __name__ == '__main__':
- app = QGuiApplication(sys.argv)
- view = QQuickView()
- qml_file = os.fspath(Path(__file__).resolve().parent / 'view.qml')
- view.setSource(QUrl.fromLocalFile(qml_file))
- if view.status() == QQuickView.Error:
- sys.exit(-1)
-
- root = view.rootObject()
- root.textRotationChanged.connect(sayThis)
- root.buttonClicked.connect(lambda: sayThis("clicked button (QML top-level signal)"))
-
- view.show()
- res = app.exec()
- # Deleting the view before it goes out of scope is required to make sure all child QML instances
- # are destroyed in the correct order.
- del view
- sys.exit(res)
diff --git a/examples/declarative/signals/qmltopy3/qmltopy3.pyproject b/examples/declarative/signals/qmltopy3/qmltopy3.pyproject
deleted file mode 100644
index e6f087cce..000000000
--- a/examples/declarative/signals/qmltopy3/qmltopy3.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["main.py", "view.qml"]
-}
diff --git a/examples/declarative/signals/qmltopy3/view.qml b/examples/declarative/signals/qmltopy3/view.qml
deleted file mode 100644
index e2f27385e..000000000
--- a/examples/declarative/signals/qmltopy3/view.qml
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick
-
-Rectangle {
- id: page
-
- signal buttonClicked
- signal textRotationChanged(double rot)
-
- width: 500; height: 200
- color: "lightgray"
-
- Text {
- id: helloText
- text: "Hello world!"
- y: 30
- x: page.width/2-width/2
- font.pointSize: 24; font.bold: true
- onRotationChanged: textRotationChanged(rotation)
-
- states: State {
- name: "down"; when: buttonMouseArea.pressed === true
- PropertyChanges {
- target: helloText;
- rotation: 180;
- y: 100;
- }
- }
-
- transitions: Transition {
- from: ""; to: "down"; reversible: true
- ParallelAnimation {
- NumberAnimation {
- properties: "y,rotation"
- duration: 500
- easing.type: Easing.InOutQuad
- }
- }
- }
- }
-
- Rectangle {
- id: button
- width: 150; height: 40
- color: "darkgray"
- anchors.horizontalCenter: page.horizontalCenter
- y: 120
- MouseArea {
- id: buttonMouseArea
- objectName: "buttonMouseArea"
- anchors.fill: parent
- onClicked: {
- buttonClicked()
- }
- }
- Text {
- id: buttonText
- text: "Press me!"
- anchors.horizontalCenter: button.horizontalCenter
- anchors.verticalCenter: button.verticalCenter
- font.pointSize: 16
- }
- }
-}
diff --git a/examples/declarative/signals/qmltopy4/main.py b/examples/declarative/signals/qmltopy4/main.py
deleted file mode 100644
index 96183c02d..000000000
--- a/examples/declarative/signals/qmltopy4/main.py
+++ /dev/null
@@ -1,71 +0,0 @@
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-from pathlib import Path
-import sys
-from PySide6.QtCore import QObject, QUrl
-from PySide6.QtGui import QGuiApplication
-from PySide6.QtQuick import QQuickView
-
-
-def sayThis(s):
- print(s)
-
-
-if __name__ == '__main__':
- app = QGuiApplication(sys.argv)
- view = QQuickView()
- qml_file = os.fspath(Path(__file__).resolve().parent / 'view.qml')
- view.setSource(QUrl.fromLocalFile(qml_file))
- if view.status() == QQuickView.Error:
- sys.exit(-1)
-
- root = view.rootObject()
- button = root.findChild(QObject, "buttonMouseArea")
- button.clicked.connect(lambda: sayThis("clicked button (signal directly connected)"))
-
- view.show()
- res = app.exec()
- # Deleting the view before it goes out of scope is required to make sure all child QML instances
- # are destroyed in the correct order.
- del view
- sys.exit(res)
diff --git a/examples/declarative/signals/qmltopy4/qmltopy4.pyproject b/examples/declarative/signals/qmltopy4/qmltopy4.pyproject
deleted file mode 100644
index e6f087cce..000000000
--- a/examples/declarative/signals/qmltopy4/qmltopy4.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["main.py", "view.qml"]
-}
diff --git a/examples/declarative/signals/qmltopy4/view.qml b/examples/declarative/signals/qmltopy4/view.qml
deleted file mode 100644
index 8b876277d..000000000
--- a/examples/declarative/signals/qmltopy4/view.qml
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick
-
-Rectangle {
- id: page
-
- width: 500; height: 200
- color: "lightgray"
-
- Rectangle {
- id: button
- width: 150; height: 40
- color: "darkgray"
- anchors.horizontalCenter: page.horizontalCenter
- anchors.verticalCenter: page.verticalCenter
- MouseArea {
- id: buttonMouseArea
- objectName: "buttonMouseArea"
- anchors.fill: parent
- }
- Text {
- id: buttonText
- text: "Press me!"
- anchors.horizontalCenter: button.horizontalCenter
- anchors.verticalCenter: button.verticalCenter
- font.pointSize: 16
- }
- }
-}
diff --git a/examples/declarative/stringlistmodel/doc/stringlistmodel.png b/examples/declarative/stringlistmodel/doc/stringlistmodel.png
deleted file mode 100644
index eeb9b518a..000000000
--- a/examples/declarative/stringlistmodel/doc/stringlistmodel.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/stringlistmodel/doc/stringlistmodel.rst b/examples/declarative/stringlistmodel/doc/stringlistmodel.rst
deleted file mode 100644
index 4c00ed130..000000000
--- a/examples/declarative/stringlistmodel/doc/stringlistmodel.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-String List Model Example
-=========================
-
-A model may be a simple 'list',
-which provides the contents of the list via the modelData role.
-
-.. image:: stringlistmodel.png
- :width: 400
- :alt: String List Model Screenshot
diff --git a/examples/declarative/stringlistmodel/stringlistmodel.py b/examples/declarative/stringlistmodel/stringlistmodel.py
deleted file mode 100644
index 4e5e54466..000000000
--- a/examples/declarative/stringlistmodel/stringlistmodel.py
+++ /dev/null
@@ -1,64 +0,0 @@
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from pathlib import Path
-import sys
-from PySide6.QtCore import QUrl
-from PySide6.QtGui import QGuiApplication
-from PySide6.QtQuick import QQuickView
-
-# This example illustrates exposing a QStringList as a model in QML
-
-if __name__ == '__main__':
- app = QGuiApplication(sys.argv)
-
- dataList = ["Item 1", "Item 2", "Item 3", "Item 4"]
-
- view = QQuickView()
- view.setInitialProperties({"model": dataList })
-
- qml_file = Path(__file__).parent / "view.qml"
- view.setSource(QUrl.fromLocalFile(qml_file))
- view.show()
-
- r = app.exec()
- del view
- sys.exit(r)
diff --git a/examples/declarative/stringlistmodel/stringlistmodel.pyproject b/examples/declarative/stringlistmodel/stringlistmodel.pyproject
deleted file mode 100644
index 5ec3e85d1..000000000
--- a/examples/declarative/stringlistmodel/stringlistmodel.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["stringlistmodel.py", "view.qml"]
-}
diff --git a/examples/declarative/stringlistmodel/view.qml b/examples/declarative/stringlistmodel/view.qml
deleted file mode 100644
index 1312aca01..000000000
--- a/examples/declarative/stringlistmodel/view.qml
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick
-
-ListView {
- width: 100
- height: 100
- required model
-
- delegate: Rectangle {
- required property string modelData
- height: 25
- width: 100
- Text { text: parent.modelData }
- }
-}
diff --git a/examples/declarative/textproperties/doc/textproperties.png b/examples/declarative/textproperties/doc/textproperties.png
deleted file mode 100644
index b14bb73d7..000000000
--- a/examples/declarative/textproperties/doc/textproperties.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/textproperties/doc/textproperties.rst b/examples/declarative/textproperties/doc/textproperties.rst
deleted file mode 100644
index 81829dfdc..000000000
--- a/examples/declarative/textproperties/doc/textproperties.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-Text Properties Example
-=======================
-
-A Python application that demonstrates how to load a qml file
-using Material design, to change the look of text.
-
-.. image:: textproperties.png
- :width: 400
- :alt: Text Properties Screenshot
diff --git a/examples/declarative/textproperties/main.py b/examples/declarative/textproperties/main.py
deleted file mode 100644
index 0408313d3..000000000
--- a/examples/declarative/textproperties/main.py
+++ /dev/null
@@ -1,113 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import sys
-from pathlib import Path
-
-from PySide6.QtCore import QObject, Slot
-from PySide6.QtGui import QGuiApplication
-from PySide6.QtQml import QQmlApplicationEngine, QmlElement
-from PySide6.QtQuickControls2 import QQuickStyle
-
-
-# To be used on the @QmlElement decorator
-# (QML_IMPORT_MINOR_VERSION is optional)
-QML_IMPORT_NAME = "io.qt.textproperties"
-QML_IMPORT_MAJOR_VERSION = 1
-
-
-@QmlElement
-class Bridge(QObject):
-
- @Slot(str, result=str)
- def getColor(self, s):
- if s.lower() == "red":
- return "#ef9a9a"
- elif s.lower() == "green":
- return "#a5d6a7"
- elif s.lower() == "blue":
- return "#90caf9"
- else:
- return "white"
-
- @Slot(float, result=int)
- def getSize(self, s):
- size = int(s * 34)
- if size <= 0:
- return 1
- else:
- return size
-
- @Slot(str, result=bool)
- def getItalic(self, s):
- if s.lower() == "italic":
- return True
- else:
- return False
-
- @Slot(str, result=bool)
- def getBold(self, s):
- if s.lower() == "bold":
- return True
- else:
- return False
-
- @Slot(str, result=bool)
- def getUnderline(self, s):
- if s.lower() == "underline":
- return True
- else:
- return False
-
-
-if __name__ == '__main__':
- app = QGuiApplication(sys.argv)
- QQuickStyle.setStyle("Material")
- engine = QQmlApplicationEngine()
-
- # Get the path of the current directory, and then add the name
- # of the QML file, to load it.
- qml_file = Path(__file__).parent / 'view.qml'
- engine.load(qml_file)
-
- if not engine.rootObjects():
- sys.exit(-1)
-
- sys.exit(app.exec())
diff --git a/examples/declarative/textproperties/textproperties.pyproject b/examples/declarative/textproperties/textproperties.pyproject
deleted file mode 100644
index e6f087cce..000000000
--- a/examples/declarative/textproperties/textproperties.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["main.py", "view.qml"]
-}
diff --git a/examples/declarative/textproperties/view.qml b/examples/declarative/textproperties/view.qml
deleted file mode 100644
index 567bd4578..000000000
--- a/examples/declarative/textproperties/view.qml
+++ /dev/null
@@ -1,197 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-import QtQuick
-import QtQuick.Layouts
-import QtQuick.Controls
-import QtQuick.Window
-import QtQuick.Controls.Material
-
-import io.qt.textproperties
-
-ApplicationWindow {
- id: page
- width: 800
- height: 400
- visible: true
- Material.theme: Material.Dark
- Material.accent: Material.Red
-
- Bridge {
- id: bridge
- }
-
- GridLayout {
- id: grid
- columns: 2
- rows: 3
-
- ColumnLayout {
- spacing: 2
- Layout.columnSpan: 1
- Layout.preferredWidth: 400
-
- Text {
- id: leftlabel
- Layout.alignment: Qt.AlignHCenter
- color: "white"
- font.pointSize: 16
- text: "Qt for Python"
- Layout.preferredHeight: 100
- Material.accent: Material.Green
- }
-
- RadioButton {
- id: italic
- Layout.alignment: Qt.AlignLeft
- text: "Italic"
- onToggled: {
- leftlabel.font.italic = bridge.getItalic(italic.text)
- leftlabel.font.bold = bridge.getBold(italic.text)
- leftlabel.font.underline = bridge.getUnderline(italic.text)
-
- }
- }
- RadioButton {
- id: bold
- Layout.alignment: Qt.AlignLeft
- text: "Bold"
- onToggled: {
- leftlabel.font.italic = bridge.getItalic(bold.text)
- leftlabel.font.bold = bridge.getBold(bold.text)
- leftlabel.font.underline = bridge.getUnderline(bold.text)
- }
- }
- RadioButton {
- id: underline
- Layout.alignment: Qt.AlignLeft
- text: "Underline"
- onToggled: {
- leftlabel.font.italic = bridge.getItalic(underline.text)
- leftlabel.font.bold = bridge.getBold(underline.text)
- leftlabel.font.underline = bridge.getUnderline(underline.text)
- }
- }
- RadioButton {
- id: noneradio
- Layout.alignment: Qt.AlignLeft
- text: "None"
- checked: true
- onToggled: {
- leftlabel.font.italic = bridge.getItalic(noneradio.text)
- leftlabel.font.bold = bridge.getBold(noneradio.text)
- leftlabel.font.underline = bridge.getUnderline(noneradio.text)
- }
- }
- }
-
- ColumnLayout {
- id: rightcolumn
- spacing: 2
- Layout.columnSpan: 1
- Layout.preferredWidth: 400
- Layout.preferredHeight: 400
- Layout.fillWidth: true
-
- RowLayout {
- Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
-
-
- Button {
- id: red
- text: "Red"
- highlighted: true
- Material.accent: Material.Red
- onClicked: {
- leftlabel.color = bridge.getColor(red.text)
- }
- }
- Button {
- id: green
- text: "Green"
- highlighted: true
- Material.accent: Material.Green
- onClicked: {
- leftlabel.color = bridge.getColor(green.text)
- }
- }
- Button {
- id: blue
- text: "Blue"
- highlighted: true
- Material.accent: Material.Blue
- onClicked: {
- leftlabel.color = bridge.getColor(blue.text)
- }
- }
- Button {
- id: nonebutton
- text: "None"
- highlighted: true
- Material.accent: Material.BlueGrey
- onClicked: {
- leftlabel.color = bridge.getColor(nonebutton.text)
- }
- }
- }
- RowLayout {
- Layout.fillWidth: true
- Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
- Text {
- id: rightlabel
- color: "white"
- Layout.alignment: Qt.AlignLeft
- text: "Font size"
- Material.accent: Material.White
- }
- Slider {
- width: rightcolumn.width*0.6
- Layout.alignment: Qt.AlignRight
- id: slider
- value: 0.5
- onValueChanged: {
- leftlabel.font.pointSize = bridge.getSize(value)
- }
- }
- }
- }
- }
-}
diff --git a/examples/declarative/usingmodel/doc/usingmodel.png b/examples/declarative/usingmodel/doc/usingmodel.png
deleted file mode 100644
index b4240951b..000000000
--- a/examples/declarative/usingmodel/doc/usingmodel.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/usingmodel/doc/usingmodel.rst b/examples/declarative/usingmodel/doc/usingmodel.rst
deleted file mode 100644
index 11b476d09..000000000
--- a/examples/declarative/usingmodel/doc/usingmodel.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-Using Model Example
-===================
-
-A Python application that demonstrates how to use a :ref:`QAbstractListModel`
-with QML.
-
-.. image:: usingmodel.png
- :width: 400
- :alt: Using Model Screenshot
diff --git a/examples/declarative/usingmodel/usingmodel.py b/examples/declarative/usingmodel/usingmodel.py
deleted file mode 100644
index 3d5a03964..000000000
--- a/examples/declarative/usingmodel/usingmodel.py
+++ /dev/null
@@ -1,108 +0,0 @@
-
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-from pathlib import Path
-import sys
-from PySide6.QtCore import QAbstractListModel, Qt, QUrl, QByteArray
-from PySide6.QtGui import QGuiApplication
-from PySide6.QtQuick import QQuickView
-from PySide6.QtQml import qmlRegisterSingletonType
-
-
-class PersonModel (QAbstractListModel):
- MyRole = Qt.UserRole + 1
-
- def __init__(self, parent=None):
- QAbstractListModel.__init__(self, parent)
- self._data = []
-
- def roleNames(self):
- roles = {
- PersonModel.MyRole: QByteArray(b'modelData'),
- Qt.DisplayRole: QByteArray(b'display')
- }
- return roles
-
- def rowCount(self, index):
- return len(self._data)
-
- def data(self, index, role):
- d = self._data[index.row()]
-
- if role == Qt.DisplayRole:
- return d['name']
- elif role == Qt.DecorationRole:
- return Qt.black
- elif role == PersonModel.MyRole:
- return d['myrole']
- return None
-
- def populate(self, data=None):
- for item in data:
- self._data.append(item)
-
-
-def model_callback(engine):
- my_model = PersonModel()
- data = [{'name': 'Qt', 'myrole': 'role1'},
- {'name': 'PySide', 'myrole': 'role2'}]
- my_model.populate(data)
- return my_model
-
-
-if __name__ == '__main__':
- app = QGuiApplication(sys.argv)
- view = QQuickView()
- view.setResizeMode(QQuickView.SizeRootObjectToView)
-
- qmlRegisterSingletonType(PersonModel, "PersonModel", 1, 0, "MyModel", model_callback)
- qml_file = os.fspath(Path(__file__).resolve().parent / 'view.qml')
- view.setSource(QUrl.fromLocalFile(qml_file))
- if view.status() == QQuickView.Error:
- sys.exit(-1)
- view.show()
-
- r = app.exec()
- # Deleting the view before it goes out of scope is required to make sure all child QML instances
- # are destroyed in the correct order.
- del view
- sys.exit(r)
diff --git a/examples/declarative/usingmodel/usingmodel.pyproject b/examples/declarative/usingmodel/usingmodel.pyproject
deleted file mode 100644
index 600cdb409..000000000
--- a/examples/declarative/usingmodel/usingmodel.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["view.qml", "usingmodel.py"]
-}
diff --git a/examples/declarative/usingmodel/view.qml b/examples/declarative/usingmodel/view.qml
deleted file mode 100644
index 4e1368e34..000000000
--- a/examples/declarative/usingmodel/view.qml
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt for Python examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick
-import PersonModel
-
-ListView {
- width: 100
- height: 100
- anchors.fill: parent
- model: MyModel
- delegate: Component {
- Rectangle {
- height: 25
- width: 100
- Text {
- function displayText() {
- var result = ""
- if (typeof display !== "undefined")
- result = display + ": "
- result += modelData
- return result
- }
-
- text: displayText()
- }
- }
- }
-}