From 7aac3852c1cdb2a877067a46e94573bba1288f9e Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 26 Apr 2017 17:30:08 +0200 Subject: Fix saving table size We need to make sure the model is avaliable for the table until it hits the destructor. Fixes #347 Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- desktop-widgets/tab-widgets/maintab.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index cade102a5..066679b2f 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -59,6 +59,12 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), memset(&displayed_dive, 0, sizeof(displayed_dive)); memset(&displayedTrip, 0, sizeof(displayedTrip)); + // This makes sure we only delete the models + // after the destructor of the tables, + // this is needed to save the column sizes. + cylindersModel->setParent(ui.cylinders); + weightModel->setParent(ui.weights); + ui.cylinders->setModel(cylindersModel); ui.weights->setModel(weightModel); closeMessage(); -- cgit v1.2.3-70-g09d2