mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
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>
This commit is contained in:
parent
c29109744e
commit
d1366257f0
1 changed files with 9 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue