From 1af4032dade4b58e470c47eeb2b4eb7b44119da1 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 12 Jan 2022 21:27:35 +0100 Subject: [PATCH] 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 Signed-off-by: Berthold Stoeger --- qt-models/cylindermodel.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp index fa0dac1b9..a8083e971 100644 --- a/qt-models/cylindermodel.cpp +++ b/qt-models/cylindermodel.cpp @@ -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 mapping = get_cylinder_map_for_remove(d->cylinders.nr + 1, index.row());