On the equipment tab, unused cylinders (automatically added, no pressure data) could be hidden. This was implemented using a QSortFilterProxyModel. Apparently, it causes confusion if cylinders in the middle of the list are hidden. Therefore, only hide cylinders at the end of the list. QSortFilterProxyModel seems the wrong tool for that job, so remove it and add a flag "hideUnused" to the base model. Calculate the number of cylinders when changing the dive. This is rather complex, because the same model is used for the planner (which doesn't hide cylinders) and the equipment tab (which does). Of course, syncing core and model now becomes harder. For instance, the caching of the number of rows was removed in a37939889b1a77dd269fd7f25f97b813f733133a and now has to be readded. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
44 lines
1013 B
C++
44 lines
1013 B
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef TAB_DIVE_EQUIPMENT_H
|
|
#define TAB_DIVE_EQUIPMENT_H
|
|
|
|
#include "TabBase.h"
|
|
#include "ui_TabDiveEquipment.h"
|
|
#include "qt-models/completionmodels.h"
|
|
#include "desktop-widgets/divelistview.h"
|
|
|
|
namespace Ui {
|
|
class TabDiveEquipment;
|
|
};
|
|
|
|
class WeightModel;
|
|
class CylindersModel;
|
|
|
|
class TabDiveEquipment : public TabBase {
|
|
Q_OBJECT
|
|
public:
|
|
TabDiveEquipment(QWidget *parent = 0);
|
|
~TabDiveEquipment();
|
|
void updateData() override;
|
|
void clear() override;
|
|
void closeWarning();
|
|
|
|
private slots:
|
|
void divesChanged(const QVector<dive *> &dives, DiveField field);
|
|
void addCylinder_clicked();
|
|
void addWeight_clicked();
|
|
void toggleTriggeredColumn();
|
|
void editCylinderWidget(const QModelIndex &index);
|
|
void editWeightWidget(const QModelIndex &index);
|
|
void on_suit_editingFinished();
|
|
void divesEdited(int count);
|
|
|
|
private:
|
|
Ui::TabDiveEquipment ui;
|
|
SuitCompletionModel suitModel;
|
|
CylindersModel *cylindersModel;
|
|
WeightModel *weightModel;
|
|
};
|
|
|
|
#endif // TAB_DIVE_EQUIPMENT_H
|