summaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-25 07:28:22 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-25 07:30:50 -0700
commitd1366257f081fc28939bd6abe9b67b1dba3fb07a (patch)
treecd0f442a7ada78ebcde96c7e8ad2930a7fc83a9b /qt-ui/divelistview.cpp
parentc29109744e56a919b2d5ef417ac287bb2aada6cf (diff)
downloadsubsurface-d1366257f081fc28939bd6abe9b67b1dba3fb07a.tar.gz
Dive list: make saving / restoring column widths actually work
It's a testament to how much I mess around with things that I hadn't noticed that saving the column width doesn't actually work. Or actually, saving them worked, loading them back failed as it was done too early and the setColumnWidth() calls had no effect - and so the next time we quit subsurface, the default width of 100 was written over all the saved values. This seems like an incredible hack but it has the advantage of actually working. I look forward to someone with better insides into the inner workings of Qt to properly fix this. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r--qt-ui/divelistview.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index 29157737f..cbb75c102 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -59,7 +59,8 @@ DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelec
searchBox.hide();
connect(showSearchBox, SIGNAL(triggered(bool)), this, SLOT(showSearchEdit()));
connect(&searchBox, SIGNAL(textChanged(QString)), model, SLOT(setFilterFixedString(QString)));
- setupUi();
+ // calling setupUi() here appears to be too early; it does NOT correctly set the column widths
+ // setupUi();
}
DiveListView::~DiveListView()
@@ -315,6 +316,13 @@ void DiveListView::headerClicked(int i)
void DiveListView::reload(DiveTripModel::Layout layout, bool forceSort)
{
+ // we want to run setupUi() once we actually are displaying something
+ // in the widget
+ static bool first = true;
+ if (first && dive_table.nr > 0) {
+ setupUi();
+ first = false;
+ }
if (layout == DiveTripModel::CURRENT)
layout = currentLayout;
else