QmlDesigner: Implement effect maker node drag to reorder

Also small relevant tweaks

Fixes: QDS-10411
Change-Id: I332482d4726c79786edbc0a5fa1e8f6489d77f11
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Amr Elsayed <amr.elsayed@qt.io>
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
Mahmoud Badri
2023-09-04 14:17:01 +03:00
parent 6251730f8f
commit 9bbe78df8b
7 changed files with 147 additions and 19 deletions

View File

@@ -49,6 +49,17 @@ void EffectMakerModel::addNode(const QString &nodeQenPath)
endInsertRows();
}
void EffectMakerModel::moveNode(int fromIdx, int toIdx)
{
if (fromIdx == toIdx)
return;
int toIdxAdjusted = fromIdx < toIdx ? toIdx + 1 : toIdx; // otherwise beginMoveRows() crashes
beginMoveRows({}, fromIdx, fromIdx, {}, toIdxAdjusted);
m_nodes.move(fromIdx, toIdx);
endMoveRows();
}
void EffectMakerModel::removeNode(int idx)
{
beginRemoveRows({}, idx, idx);