Dive list view: move column width logic back from DiveTripModel

Conceptually, the width of the columns should probably reside in
the view not the model. But much more severly, the old code didn't
work: Columns were set in a DiveTripModel, which was deleted
right away.

Therefore, move the logic back to the DiveListView. Introduce
a QVector<int> of the initial column widths, so that they can be
erased from the setting if unchanged.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-07-25 20:40:47 +02:00 committed by Dirk Hohndel
parent d3dc698bba
commit 079b99135a
4 changed files with 53 additions and 92 deletions

View file

@ -99,13 +99,10 @@ public:
DiveTripModel(QObject *parent = 0);
Layout layout() const;
void setLayout(Layout layout);
int columnWidth(int column);
void setColumnWidth(int column, int width);
private:
void setupModelData();
QMap<dive_trip_t *, TripItem *> trips;
QVector<int> columnWidthMap;
Layout currentLayout;
};