mirror of
https://github.com/wassname/sloth.git
synced 2026-07-18 12:40:43 +08:00
store persistent model index
This commit is contained in:
@@ -25,8 +25,10 @@ class BaseItem(QAbstractGraphicsShapeItem):
|
||||
QGraphicsItem.ItemSendsScenePositionChanges)
|
||||
self.setColor(Qt.yellow)
|
||||
|
||||
# store index and label data
|
||||
self.index_ = index
|
||||
# Store index and label data.
|
||||
# The index needs to be persistent in order to be still
|
||||
# correct when other items were deleted etc.
|
||||
self.index_ = QPersistentModelIndex(index)
|
||||
if data is None and index is not None:
|
||||
data = self.index().data(DataRole).toPyObject()
|
||||
self.data_ = data
|
||||
|
||||
Reference in New Issue
Block a user