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 <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2017-04-26 17:30:08 +02:00 committed by Dirk Hohndel
parent c4d6055e4a
commit 7aac3852c1

View file

@ -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();