RoomEditorWidget improvements

This commit is contained in:
2022-01-17 22:22:27 +01:00
parent 77e7e18c26
commit e5406ed0ce
16 changed files with 335 additions and 79 deletions
+12 -1
View File
@@ -273,12 +273,17 @@ Qt::ItemFlags ProjectTreeModel::flags(const QModelIndex &index) const
case NodeType::TimeLine:
case NodeType::Object:
case NodeType::Room:
flags |= Qt::ItemIsEditable;
flags |= Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
}
return flags;
}
Qt::DropActions ProjectTreeModel::supportedDropActions() const
{
return QAbstractItemModel::supportedDropActions() | Qt::MoveAction;
}
bool ProjectTreeModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
switch (const auto nodeType = this->nodeType(index))
@@ -314,6 +319,12 @@ bool ProjectTreeModel::insertRows(int row, int count, const QModelIndex &parent)
return false;
}
bool ProjectTreeModel::moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild)
{
qDebug() << "called" << sourceParent << sourceRow << count << destinationParent << destinationChild;
return false;
}
bool ProjectTreeModel::removeRows(int row, int count, const QModelIndex &parent)
{
if (auto result = removeRowsFor<Sprite>(row, count, parent)) return *result;