RoomEditorWidget improvements

This commit is contained in:
feedc0de committed 2022-01-17 22:22:27 +01:00
1 parent 77e7e18c26
commit e5406ed0ce
16 files changed
+335 -79

No files matched your search

+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;
+2
View File
@@ -42,8 +42,10 @@ public:
int columnCount(const QModelIndex &parent) const override;
QVariant data(const QModelIndex &index, int role) const override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
Qt::DropActions supportedDropActions() const override;
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
bool insertRows(int row, int count, const QModelIndex &parent) override;
bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override;
bool removeRows(int row, int count, const QModelIndex &parent) override;
ProjectContainer *project() { return m_project; }