mirror of
https://github.com/wassname/sloth.git
synced 2026-08-12 12:30:50 +08:00
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:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user