aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative/usingmodel/usingmodel.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/usingmodel/usingmodel.py')
-rw-r--r--examples/declarative/usingmodel/usingmodel.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/examples/declarative/usingmodel/usingmodel.py b/examples/declarative/usingmodel/usingmodel.py
index 7c54cc49e..4dcb8279e 100644
--- a/examples/declarative/usingmodel/usingmodel.py
+++ b/examples/declarative/usingmodel/usingmodel.py
@@ -46,17 +46,18 @@ from PySide6.QtCore import QAbstractListModel, Qt, QUrl, QByteArray
from PySide6.QtGui import QGuiApplication
from PySide6.QtQuick import QQuickView
+
class PersonModel (QAbstractListModel):
MyRole = Qt.UserRole + 1
- def __init__(self, parent = None):
+ 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')
+ PersonModel.MyRole: QByteArray(b'modelData'),
+ Qt.DisplayRole: QByteArray(b'display')
}
return roles
@@ -75,8 +76,9 @@ class PersonModel (QAbstractListModel):
return None
def populate(self):
- self._data.append({'name':'Qt', 'myrole':'role1'})
- self._data.append({'name':'PySide', 'myrole':'role2'})
+ self._data.append({'name': 'Qt', 'myrole': 'role1'})
+ self._data.append({'name': 'PySide', 'myrole': 'role2'})
+
if __name__ == '__main__':
app = QGuiApplication(sys.argv)