aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative')
-rw-r--r--examples/declarative/extending/chapter1-basics/basics.py8
-rw-r--r--examples/declarative/extending/chapter2-methods/methods.py8
-rw-r--r--examples/declarative/extending/chapter3-bindings/bindings.py8
-rw-r--r--examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py4
-rw-r--r--examples/declarative/scrolling.py1
-rw-r--r--examples/declarative/signals/pytoqml1/main.py1
-rw-r--r--examples/declarative/signals/qmltopy1/main.py1
-rw-r--r--examples/declarative/signals/qmltopy2/main.py1
-rw-r--r--examples/declarative/signals/qmltopy3/main.py3
-rw-r--r--examples/declarative/signals/qmltopy4/main.py1
-rw-r--r--examples/declarative/textproperties/main.py3
-rw-r--r--examples/declarative/usingmodel.py1
12 files changed, 17 insertions, 23 deletions
diff --git a/examples/declarative/extending/chapter1-basics/basics.py b/examples/declarative/extending/chapter1-basics/basics.py
index edb612739..95ee36362 100644
--- a/examples/declarative/extending/chapter1-basics/basics.py
+++ b/examples/declarative/extending/chapter1-basics/basics.py
@@ -59,9 +59,9 @@ class PieChart (QQuickPaintedItem):
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);
+ painter.setPen(pen)
+ painter.setRenderHints(QPainter.Antialiasing, True)
+ painter.drawPie(self.boundingRect().adjusted(1,1,-1,-1), 90 * 16, 290 * 16)
def getColor(self):
return self._color
@@ -83,7 +83,7 @@ class PieChart (QQuickPaintedItem):
if __name__ == '__main__':
app = QGuiApplication(sys.argv)
- qmlRegisterType(PieChart, 'Charts', 1, 0, 'PieChart');
+ qmlRegisterType(PieChart, 'Charts', 1, 0, 'PieChart')
view = QQuickView()
view.setResizeMode(QQuickView.SizeRootObjectToView)
diff --git a/examples/declarative/extending/chapter2-methods/methods.py b/examples/declarative/extending/chapter2-methods/methods.py
index 44e248f07..1d02628cd 100644
--- a/examples/declarative/extending/chapter2-methods/methods.py
+++ b/examples/declarative/extending/chapter2-methods/methods.py
@@ -59,9 +59,9 @@ class PieChart (QQuickPaintedItem):
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);
+ painter.setPen(pen)
+ painter.setRenderHints(QPainter.Antialiasing, True)
+ painter.drawPie(self.boundingRect().adjusted(1,1,-1,-1), 90 * 16, 290 * 16)
def getColor(self):
return self._color
@@ -88,7 +88,7 @@ class PieChart (QQuickPaintedItem):
if __name__ == '__main__':
app = QGuiApplication(sys.argv)
- qmlRegisterType(PieChart, 'Charts', 1, 0, 'PieChart');
+ qmlRegisterType(PieChart, 'Charts', 1, 0, 'PieChart')
view = QQuickView()
view.setResizeMode(QQuickView.SizeRootObjectToView)
diff --git a/examples/declarative/extending/chapter3-bindings/bindings.py b/examples/declarative/extending/chapter3-bindings/bindings.py
index 4c3895538..f20fc0bcc 100644
--- a/examples/declarative/extending/chapter3-bindings/bindings.py
+++ b/examples/declarative/extending/chapter3-bindings/bindings.py
@@ -60,9 +60,9 @@ class PieChart (QQuickPaintedItem):
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);
+ painter.setPen(pen)
+ painter.setRenderHints(QPainter.Antialiasing, True)
+ painter.drawPie(self.boundingRect().adjusted(1,1,-1,-1), 90 * 16, 290 * 16)
def getColor(self):
return self._color
@@ -93,7 +93,7 @@ class PieChart (QQuickPaintedItem):
if __name__ == '__main__':
app = QGuiApplication(sys.argv)
- qmlRegisterType(PieChart, 'Charts', 1, 0, 'PieChart');
+ qmlRegisterType(PieChart, 'Charts', 1, 0, 'PieChart')
view = QQuickView()
view.setResizeMode(QQuickView.SizeRootObjectToView)
diff --git a/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py b/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py
index 7dee9d2a6..66e4dea7c 100644
--- a/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py
+++ b/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py
@@ -98,8 +98,8 @@ class PieChart (QQuickItem):
if __name__ == '__main__':
app = QGuiApplication(sys.argv)
- qmlRegisterType(PieChart, 'Charts', 1, 0, 'PieChart');
- qmlRegisterType(PieSlice, "Charts", 1, 0, "PieSlice");
+ qmlRegisterType(PieChart, 'Charts', 1, 0, 'PieChart')
+ qmlRegisterType(PieSlice, "Charts", 1, 0, "PieSlice")
view = QQuickView()
view.setResizeMode(QQuickView.SizeRootObjectToView)
diff --git a/examples/declarative/scrolling.py b/examples/declarative/scrolling.py
index 085cb17e2..b4a0ee270 100644
--- a/examples/declarative/scrolling.py
+++ b/examples/declarative/scrolling.py
@@ -45,7 +45,6 @@ import os
import sys
from PySide2.QtCore import QUrl
from PySide2.QtGui import QGuiApplication
-import PySide2.QtQml
from PySide2.QtQuick import QQuickView
# This example uses a QML file to show a scrolling list containing
diff --git a/examples/declarative/signals/pytoqml1/main.py b/examples/declarative/signals/pytoqml1/main.py
index 769dd0e1c..218d885a0 100644
--- a/examples/declarative/signals/pytoqml1/main.py
+++ b/examples/declarative/signals/pytoqml1/main.py
@@ -45,7 +45,6 @@ import os
import sys
from PySide2.QtCore import QTimer, QUrl
from PySide2.QtGui import QGuiApplication
-import PySide2.QtQml
from PySide2.QtQuick import QQuickView
if __name__ == '__main__':
diff --git a/examples/declarative/signals/qmltopy1/main.py b/examples/declarative/signals/qmltopy1/main.py
index 4c993b452..1342dbadb 100644
--- a/examples/declarative/signals/qmltopy1/main.py
+++ b/examples/declarative/signals/qmltopy1/main.py
@@ -45,7 +45,6 @@ import os
import sys
from PySide2.QtCore import QObject, QUrl, Slot
from PySide2.QtGui import QGuiApplication
-import PySide2.QtQml
from PySide2.QtQuick import QQuickView
class Console(QObject):
diff --git a/examples/declarative/signals/qmltopy2/main.py b/examples/declarative/signals/qmltopy2/main.py
index 10cbd8870..9b0aca815 100644
--- a/examples/declarative/signals/qmltopy2/main.py
+++ b/examples/declarative/signals/qmltopy2/main.py
@@ -45,7 +45,6 @@ import os
import sys
from PySide2.QtCore import QObject, QUrl, Slot
from PySide2.QtGui import QGuiApplication
-import PySide2.QtQml
from PySide2.QtQuick import QQuickView
class RotateValue(QObject):
diff --git a/examples/declarative/signals/qmltopy3/main.py b/examples/declarative/signals/qmltopy3/main.py
index 8de1eacee..485dd62f5 100644
--- a/examples/declarative/signals/qmltopy3/main.py
+++ b/examples/declarative/signals/qmltopy3/main.py
@@ -43,9 +43,8 @@ from __future__ import print_function
import os
import sys
-from PySide2.QtCore import QObject, QUrl
+from PySide2.QtCore import QUrl
from PySide2.QtGui import QGuiApplication
-import PySide2.QtQml
from PySide2.QtQuick import QQuickView
def sayThis(s):
diff --git a/examples/declarative/signals/qmltopy4/main.py b/examples/declarative/signals/qmltopy4/main.py
index a6cc3580f..d165e61f3 100644
--- a/examples/declarative/signals/qmltopy4/main.py
+++ b/examples/declarative/signals/qmltopy4/main.py
@@ -45,7 +45,6 @@ import os
import sys
from PySide2.QtCore import QObject, QUrl
from PySide2.QtGui import QGuiApplication
-import PySide2.QtQml
from PySide2.QtQuick import QQuickView
def sayThis(s):
diff --git a/examples/declarative/textproperties/main.py b/examples/declarative/textproperties/main.py
index 8da443edc..2f9b987d0 100644
--- a/examples/declarative/textproperties/main.py
+++ b/examples/declarative/textproperties/main.py
@@ -44,6 +44,7 @@ from os.path import abspath, dirname, join
from PySide2.QtCore import QObject, Slot
from PySide2.QtGui import QGuiApplication
from PySide2.QtQml import QQmlApplicationEngine
+from PySide2.QtQuickControls2 import QQuickStyle
class Bridge(QObject):
@@ -90,8 +91,8 @@ class Bridge(QObject):
if __name__ == '__main__':
- sys.argv += ['--style', 'material']
app = QGuiApplication(sys.argv)
+ QQuickStyle.setStyle("Material")
engine = QQmlApplicationEngine()
# Instance of the Python object
diff --git a/examples/declarative/usingmodel.py b/examples/declarative/usingmodel.py
index 2629cf35f..9b67bd0d4 100644
--- a/examples/declarative/usingmodel.py
+++ b/examples/declarative/usingmodel.py
@@ -43,7 +43,6 @@ from __future__ import print_function
import os
import sys
-import PySide2.QtQml
from PySide2.QtCore import QAbstractListModel, Qt, QUrl, QByteArray
from PySide2.QtGui import QGuiApplication
from PySide2.QtQuick import QQuickView