EffectMaker: Fix crash after opening saved effect when nodes exist

Clear and removeAllNodes functions were consolidated into one clear()
function, which now properly resets the entire model. This makes UI
properly synced to actual model state when composition is opened, so
the phantom nodes will no longer appear.

Fixes: QDS-11347
Change-Id: I204760cca6af669daa43a18bfb199dfbf14b73cb
Reviewed-by: Amr Elsayed <amr.elsayed@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
Miikka Heikkinen
2023-11-21 15:01:00 +02:00
parent 701d4b2146
commit fc456a74d4
3 changed files with 3 additions and 23 deletions

View File

@@ -139,7 +139,7 @@ void EffectMakerModel::removeNode(int idx)
bakeShaders();
}
void EffectMakerModel::removeAllNodes()
void EffectMakerModel::clear()
{
beginResetModel();
qDeleteAll(m_nodes);
@@ -180,24 +180,6 @@ const QString &EffectMakerModel::qmlComponentString() const
return m_qmlComponentString;
}
void EffectMakerModel::clear()
{
if (m_nodes.isEmpty())
return;
beginRemoveRows({}, 0, m_nodes.count());
for (CompositionNode *node : std::as_const(m_nodes))
delete node;
m_nodes.clear();
endRemoveRows();
setIsEmpty(true);
bakeShaders();
}
const QList<Uniform *> EffectMakerModel::allUniforms()
{
QList<Uniform *> uniforms = {};