planner: properly keep track of cylinder count in model

In a40b40a the cylinder-hiding functionality was changed,
which made it necessary to keep track of the number of
cylinders. Ironically, that code was removed previously,
as it was redundant. The count was not readded to the
functions called by the planner, making editing of cylinders
in the planner impossible.

I wonder more and more if the models for planner and the
equipment tab should be changed. They are too different.

Fixes #3375

Reported-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-01-12 21:27:35 +01:00 committed by Dirk Hohndel
parent ab830fcfd7
commit 1af4032dad

View file

@ -484,6 +484,7 @@ void CylindersModel::add()
cylinder_t cyl = create_new_cylinder(d);
beginInsertRows(QModelIndex(), row, row);
add_cylinder(&d->cylinders, row, cyl);
++numRows;
endInsertRows();
emit dataChanged(createIndex(row, 0), createIndex(row, COLUMNS - 1));
}
@ -539,6 +540,7 @@ void CylindersModel::remove(QModelIndex index)
beginRemoveRows(QModelIndex(), index.row(), index.row());
remove_cylinder(d, index.row());
--numRows;
endRemoveRows();
std::vector<int> mapping = get_cylinder_map_for_remove(d->cylinders.nr + 1, index.row());