Check for color valid when using column coloring

This commit is contained in:
Charles Haley 2011-05-22 19:55:46 +01:00
parent 0bd580f572
commit 29b453ba23

View File

@ -726,7 +726,9 @@ class BooksModel(QAbstractTableModel): # {{{
txt = unicode(index.data(Qt.DisplayRole).toString()) txt = unicode(index.data(Qt.DisplayRole).toString())
if len(colors) > 0 and txt in values: if len(colors) > 0 and txt in values:
try: try:
return QColor(colors[values.index(txt)]) color = colors[values.index(txt)]
if QColor.isValid(color):
return QColor(color)
except: except:
pass pass
return None return None