forked from qt-creator/qt-creator
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:
@@ -69,7 +69,7 @@ Item {
|
||||
tooltip: qsTr("Remove all effect nodes.")
|
||||
enabled: !EffectMakerBackend.effectMakerModel.isEmpty
|
||||
|
||||
onClicked: EffectMakerBackend.effectMakerModel.removeAllNodes()
|
||||
onClicked: EffectMakerBackend.effectMakerModel.clear()
|
||||
}
|
||||
|
||||
HelperWidgets.AbstractButton {
|
||||
|
@@ -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 = {};
|
||||
|
@@ -63,7 +63,7 @@ public:
|
||||
|
||||
Q_INVOKABLE void moveNode(int fromIdx, int toIdx);
|
||||
Q_INVOKABLE void removeNode(int idx);
|
||||
Q_INVOKABLE void removeAllNodes();
|
||||
Q_INVOKABLE void clear();
|
||||
|
||||
bool shadersUpToDate() const;
|
||||
void setShadersUpToDate(bool newShadersUpToDate);
|
||||
@@ -76,8 +76,6 @@ public:
|
||||
|
||||
const QString &qmlComponentString() const;
|
||||
|
||||
void clear();
|
||||
|
||||
Q_INVOKABLE void updateQmlComponent();
|
||||
|
||||
Q_INVOKABLE void resetEffectError(int type);
|
||||
|
Reference in New Issue
Block a user