make index as fast as possible, remove check for special case parent_idx == QModelIndex()

This is checked in self.itemFromIndex anyway.
This commit is contained in:
Martin Baeuml
2013-04-09 00:10:17 +02:00
parent b3392170d0
commit a4868e994a
+2 -6
View File
@@ -628,12 +628,8 @@ class AnnotationModel(QAbstractItemModel):
if parent_idx.isValid() and parent_idx.column() > 0:
return QModelIndex()
# Handle root item
if parent_idx == QModelIndex():
parent = self._root
# Handle normal items
else:
parent = self.itemFromIndex(parent_idx)
# Get parent. This returns the root if parent_idx is invalid.
parent = self.itemFromIndex(parent_idx)
if row < 0 or row >= parent.rowCount():
return QModelIndex()
if column < 0 or column >= self.columnCount():