1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
# Copyright (C) 2023 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
from __future__ import annotations
from PySide6.QtCore import QObject, Signal
class VariantBarDataMapping(QObject):
rowIndexChanged = Signal()
columnIndexChanged = Signal()
valueIndexChanged = Signal()
rowCategoriesChanged = Signal()
columnCategoriesChanged = Signal()
mappingChanged = Signal()
def __init__(self, rowIndex, columnIndex, valueIndex,
rowCategories=[], columnCategories=[]):
super().__init__(None)
self._rowIndex = rowIndex
self._columnIndex = columnIndex
self._valueIndex = valueIndex
self._rowCategories = rowCategories
self._columnCategories = columnCategories
def setRowIndex(self, index):
self._rowIndex = index
self.mappingChanged.emit()
def rowIndex(self):
return self._rowIndex
def setColumnIndex(self, index):
self._columnIndex = index
self.mappingChanged.emit()
def columnIndex(self):
return self._columnIndex
def setValueIndex(self, index):
self._valueIndex = index
self.mappingChanged.emit()
def valueIndex(self):
return self._valueIndex
def setRowCategories(self, categories):
self._rowCategories = categories
self.mappingChanged.emit()
def rowCategories(self):
return self._rowCategories
def setColumnCategories(self, categories):
self._columnCategories = categories
self.mappingChanged.emit()
def columnCategories(self):
return self._columnCategories
def remap(self, rowIndex, columnIndex, valueIndex,
rowCategories=[], columnCategories=[]):
self._rowIndex = rowIndex
self._columnIndex = columnIndex
self._valueIndex = valueIndex
self._rowCategories = rowCategories
self._columnCategories = columnCategories
self.mappingChanged.emit()
|