Skip to content
Snippets Groups Projects
Commit 2871969c authored by David Li's avatar David Li
Browse files

fix: disable density when 2d transformation is set

parent 58d55aa0
No related branches found
No related tags found
No related merge requests found
......@@ -246,7 +246,7 @@ void ModelMapper::onBeginRemoveRows(const QModelIndex &parent, int first, int /*
}
if (nestling == 0) {
callOnChildrenChange(oldChild);
callOnChildrenChange(0);
// inform siblings about the change
if(SessionItem *parent = oldChild->parent()) {
......
......@@ -38,18 +38,20 @@ ParticleLayoutItem::ParticleLayoutItem()
<< Constants::InterferenceFunction2DParaCrystalType << Constants::InterferenceFunction1DLatticeType
<< Constants::InterferenceFunction2DLatticeType);
// FIXME: not updated when child get removed
mapper()->setOnChildPropertyChange(
[this](SessionItem *, const QString &)
mapper()->setOnChildrenChange(
[this](SessionItem* item)
{
int count = 0;
for (auto child_item : childItems()) {
if (child_item->modelType() == Constants::InterferenceFunction2DParaCrystalType
|| child_item->modelType() == Constants::InterferenceFunction2DLatticeType) {
getItem(P_TOTAL_DENSITY)->setEnabled(false);
return;
count++;
}
}
getItem(P_TOTAL_DENSITY)->setEnabled(true);
if ((item && count > 0) || (!item && count > 1))
getItem(P_TOTAL_DENSITY)->setEnabled(false);
else
getItem(P_TOTAL_DENSITY)->setEnabled(true);
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment