diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-05-22 15:45:56 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-05-22 16:34:44 +0200 |
| commit | e14bae685a398f63ce5ea07c905b62ac7b74a395 (patch) | |
| tree | 725ee7b73abe545fe7ad0644da9c3ba47292ec3a /examples/graphs/3d/widgetgraphgallery/variantdataset.py | |
| parent | 9c9448277b2fba98eca14284e92a857541f76abd (diff) | |
Fix naming of the QtGraphs widget graph gallery example
Rename it to widgetgraphgallery, matching the name
in the qtgraphs repo.
Change-Id: I5e43b9d9c738860d6e5ede5687fec03b952188fe
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Diffstat (limited to 'examples/graphs/3d/widgetgraphgallery/variantdataset.py')
| -rw-r--r-- | examples/graphs/3d/widgetgraphgallery/variantdataset.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/examples/graphs/3d/widgetgraphgallery/variantdataset.py b/examples/graphs/3d/widgetgraphgallery/variantdataset.py new file mode 100644 index 000000000..752bc3887 --- /dev/null +++ b/examples/graphs/3d/widgetgraphgallery/variantdataset.py @@ -0,0 +1,39 @@ +# Copyright (C) 2023 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +from PySide6.QtCore import QObject, Signal + + +class VariantDataSet(QObject): + + itemsAdded = Signal(int, int) + dataCleared = Signal() + + def __init__(self): + super().__init__() + self._variantData = [] + + def clear(self): + for item in self._variantData: + item.clear() + del item + + self._variantData.clear() + self.dataCleared.emit() + + def addItem(self, item): + self._variantData.append(item) + addIndex = len(self._variantData) + + self.itemsAdded.emit(addIndex, 1) + return addIndex + + def addItems(self, itemList): + newCount = len(itemList) + addIndex = len(self._variantData) + self._variantData.extend(itemList) + self.itemsAdded.emit(addIndex, newCount) + return addIndex + + def itemList(self): + return self._variantData |
