aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/divelistview.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-07-25 20:40:47 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-07-27 09:08:42 -0700
commit079b99135a2340d9ffc97ceec2b2b5e288f597de (patch)
tree417878396fbcf1c5d07a4eba6114687ee75b2ffb /desktop-widgets/divelistview.h
parentd3dc698bba07b4dd23a21c826a36d8bcc87fd3be (diff)
downloadsubsurface-079b99135a2340d9ffc97ceec2b2b5e288f597de.tar.gz
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>
Diffstat (limited to 'desktop-widgets/divelistview.h')
-rw-r--r--desktop-widgets/divelistview.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/desktop-widgets/divelistview.h b/desktop-widgets/divelistview.h
index bd339fa00..e6ae8395d 100644
--- a/desktop-widgets/divelistview.h
+++ b/desktop-widgets/divelistview.h
@@ -71,12 +71,14 @@ private:
QModelIndex contextMenuIndex;
bool dontEmitDiveChangedSignal;
bool selectionSaved;
- DiveTripModel *tripModel;
+ // Remember the initial column widths, to avoid writing unchanged widths to the settings
+ QVector<int> initialColumnWidths;
/* if dive_trip_t is null, there's no problem. */
QMultiHash<dive_trip_t *, int> selectedDives;
void merge_trip(const QModelIndex &a, const int offset);
void setupUi();
+ void calculateInitialColumnWidth(const DiveTripModel &tripModel, int col);
void backupExpandedRows();
void restoreExpandedRows();
int lastVisibleColumn();