mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-06-14 00:44:34 +12:00
Fix World items positional insertion
This commit is contained in:
parent
43df0b3d8a
commit
8a9044b4ae
|
@ -217,13 +217,22 @@ class worldModel(QStandardItemModel):
|
||||||
mime_data.rows = rows
|
mime_data.rows = rows
|
||||||
return mime_data
|
return mime_data
|
||||||
|
|
||||||
def dropMimeData(self, mime_data, action, row, column, parent):
|
def dropMimeData(self, mime_data, action, row_i, column_i, parent):
|
||||||
"""insert MIME data"""
|
"""insert MIME data"""
|
||||||
parent_item = self.itemFromIndex(parent)
|
parent_item = self.itemFromIndex(parent)
|
||||||
if not parent_item:
|
if not parent_item:
|
||||||
parent_item = self.invisibleRootItem()
|
parent_item = self.invisibleRootItem()
|
||||||
for row in mime_data.rows:
|
|
||||||
parent_item.appendRow(row)
|
"""if place for drop is not specified row_i equals -1"""
|
||||||
|
if row_i == -1:
|
||||||
|
for row in mime_data.rows:
|
||||||
|
parent_item.appendRow(row)
|
||||||
|
else:
|
||||||
|
"""reverse list of rows, because QStandardItem::insertRow inserts
|
||||||
|
before the index"""
|
||||||
|
for row in reversed(mime_data.rows):
|
||||||
|
parent_item.insertRow(row_i, row)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
Loading…
Reference in a new issue