forked from qt-creator/qt-creator
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user