models: pass header descriptions in CleanerTableModel constructor

For the "CleanerHeaderModel" to work, the deriving class has to
set the header descriptions. Failing to do so led to bug #4294.

To avoid that in the future force the deriving class to pass
the headers in the constructor.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-08-31 07:36:38 +02:00
parent 7106c4d5f0
commit c0e8ea5188
8 changed files with 19 additions and 29 deletions

View file

@ -13,18 +13,17 @@
#include "core/subsurface-string.h"
#include <string>
CylindersModel::CylindersModel(bool planner, QObject *parent) : CleanerTableModel(parent),
CylindersModel::CylindersModel(bool planner, QObject *parent) :
// enum {REMOVE, TYPE, SIZE, WORKINGPRESS, START, END, O2, HE, DEPTH, MOD, MND, USE, WORKINGPRESS_INT, SIZE_INT, SENSORS};
CleanerTableModel(QStringList { QString(), tr("Type"), tr("Size"), tr("Work press."), tr("Start press."), tr("End press."), tr("O₂%"), tr("He%"),
tr("Deco switch at"), tr("Bot. MOD"), tr("MND"), tr("Use"), QString(),
QString(), tr("Sensors") }, parent),
d(nullptr),
dcNr(-1),
inPlanner(planner),
numRows(0),
tempRow(-1)
{
// enum {REMOVE, TYPE, SIZE, WORKINGPRESS, START, END, O2, HE, DEPTH, MOD, MND, USE, WORKINGPRESS_INT, SIZE_INT, SENSORS};
setHeaderDataStrings(QStringList() << "" << tr("Type") << tr("Size") << tr("Work press.") << tr("Start press.") << tr("End press.") << tr("O₂%") << tr("He%")
<< tr("Deco switch at") << tr("Bot. MOD") << tr("MND") << tr("Use") << ""
<< "" << tr("Sensors"));
connect(&diveListNotifier, &DiveListNotifier::cylindersReset, this, &CylindersModel::cylindersReset);
connect(&diveListNotifier, &DiveListNotifier::cylinderAdded, this, &CylindersModel::cylinderAdded);
connect(&diveListNotifier, &DiveListNotifier::cylinderRemoved, this, &CylindersModel::cylinderRemoved);