QmlDesigner: Implement disabling effect maker composition nodes

Disabling happens using a new button added to the section.
Also a small tweak to disable drag button when there is only one section
in a category.

Fixes: QDS-10575
Change-Id: I33884a5b333c54b2bae650943940d4858f489f7a
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
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>
This commit is contained in:
Mahmoud Badri
2023-09-06 15:18:02 +03:00
committed by Amr Elsayed
parent 1b0f25eee8
commit c5c1612c6b
8 changed files with 91 additions and 9 deletions

View File

@@ -23,6 +23,7 @@ QHash<int, QByteArray> EffectMakerModel::roleNames() const
{
QHash<int, QByteArray> roles;
roles[NameRole] = "nodeName";
roles[EnabledRole] = "nodeEnabled";
roles[UniformsRole] = "nodeUniformsModel";
return roles;
}
@@ -42,6 +43,19 @@ QVariant EffectMakerModel::data(const QModelIndex &index, int role) const
return m_nodes.at(index.row())->property(roleNames().value(role));
}
bool EffectMakerModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
if (!index.isValid() || !roleNames().contains(role))
return false;
if (role == EnabledRole) {
m_nodes.at(index.row())->setIsEnabled(value.toBool());
emit dataChanged(index, index, {role});
}
return true;
}
void EffectMakerModel::addNode(const QString &nodeQenPath)
{
beginInsertRows({}, m_nodes.size(), m_nodes.size());