def data(self, index, role): """Retrieve data at each index""" if not index.isValid(): return None if role == Qt.DecorationRole: art = self.artists[index.row()] result = layer_artist_icon(art) return result if role == Qt.CheckStateRole: art = self.artists[index.row()] result = Qt.Checked if art.visible else Qt.Unchecked return result if role == Qt.ToolTipRole: art = self.artists[index.row()] if not art.enabled: return art.disabled_message return super(LayerArtistModel, self).data(index, role)
def data(self, index, role): """Retrieve data at each index""" if not index.isValid() or index.row() >= len(self.artists): return None if role == Qt.DecorationRole: art = self.artists[index.row()] result = layer_artist_icon(art) return result if role == Qt.CheckStateRole: art = self.artists[index.row()] result = Qt.Checked if art.visible and art.enabled else Qt.Unchecked return result if role == Qt.ToolTipRole: art = self.artists[index.row()] if not art.enabled: wrapped = textwrap.fill(art.disabled_message, break_long_words=False) return wrapped return super(LayerArtistModel, self).data(index, role)