def data(self, index, role=QtCore.Qt.DisplayRole): if self._is_index_valid_for(index, self) and \ role == QtCore.Qt.DecorationRole and \ 0 <= index.row() < self.colors.number_of_colors: return gui.createAttributePixmap("", self.colors[index.row()]) else: return super().data(index, role)
def data(self, index, role=QtCore.Qt.DisplayRole): if self._is_index_valid_for(index, self) and \ role == QtCore.Qt.DecorationRole: rgb = self.plot.discrete_palette.getRGB(index.row()) return gui.createAttributePixmap("", QtGui.QColor(*rgb)) else: return super().data(index, role)
def data(self, index, role=Qt.DisplayRole): if self._is_index_valid(index) and \ role == Qt.DecorationRole and \ 0 <= index.row() < len(self): return gui.createAttributePixmap("", self.colors[index.row()]) return super().data(index, role)
def data(self, index, role=Qt.DisplayRole): if (self._is_index_valid(index) and role == Qt.DecorationRole and 0 <= index.row() < self.colors.number_of_colors): return gui.createAttributePixmap("", self.colors[index.row()]) return super().data(index, role)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) if DefaultDiscModel.icon is None: DefaultDiscModel.icon = gui.createAttributePixmap( "★", QColor(0, 0, 0, 0), Qt.black) self.hint: VarHint = DefaultHint