Fix #3664 (Program Crashes When Attempting to Add Books to 0.6.15)

This commit is contained in:
Kovid Goyal 2009-10-01 21:56:09 -06:00
parent 924e1cee7d
commit a1725b4ee3

View File

@ -147,6 +147,7 @@ class TagsModel(QAbstractItemModel):
state_map = dict(izip(names, states))
category_index = self.index(i, 0, QModelIndex())
if len(category.children) > 0:
r, self.rowCount(category_index)
self.beginRemoveRows(category_index, 0,
len(category.children)-1)
category.children = []
@ -167,6 +168,13 @@ class TagsModel(QAbstractItemModel):
item = index.internalPointer()
return item.data(role)
def headerData(self, *args):
return NONE
def flags(self, *args):
return Qt.ItemIsEnabled|Qt.ItemIsSelectable
def index(self, row, column, parent):
if not self.hasIndex(row, column, parent):
return QModelIndex()