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

@ -7,9 +7,9 @@
#include "core/qthelper.h"
#include "core/subsurface-qt/divelistnotifier.h"
FilterPresetModel::FilterPresetModel()
FilterPresetModel::FilterPresetModel() :
CleanerTableModel(QStringList { QString(), tr("Name") })
{
setHeaderDataStrings(QStringList{ "", tr("Name") });
connect(&diveListNotifier, &DiveListNotifier::dataReset, this, &FilterPresetModel::reset);
connect(&diveListNotifier, &DiveListNotifier::filterPresetAdded, this, &FilterPresetModel::filterPresetAdded);
connect(&diveListNotifier, &DiveListNotifier::filterPresetRemoved, this, &FilterPresetModel::filterPresetRemoved);