From ae68ae38bbbc981aab4b8eaf1e84a15b8ab05bf4 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 17 Jun 2013 18:59:50 -0300 Subject: Changed a lot of code to reduce boilerplate on models in the future. So, I changed a lot of code to reduce boilerplate on models in the future. Currently we do not have a lot of models, but this can increase quite rapdly. There's a second TreeModel in the works, the Yearly Statistics, this patch will save around 250 LOC for this new model, and more and more models will give us a greater saving. Iwll do that for the table models in the future too - I did the tree models now because they are the most complex case and I didn't wanted to create a second tree model without this. Signed-off-by: Tomaz Canabrava --- qt-ui/mainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'qt-ui/mainwindow.cpp') diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index f477a0d4f..45b8df80a 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -437,7 +437,7 @@ void MainWindow::initialUiSetup() /* if no width are set, use the calculated width for each column; * for that to work we need to temporarily expand all rows */ ui->ListWidget->expandAll(); - for (i = TreeItemDT::NR; i < TreeItemDT::COLUMNS; i++) { + for (i = DiveTripModel::NR; i < DiveTripModel::COLUMNS; i++) { QVariant width = settings.value(QString("colwidth%1").arg(i)); if (width.isValid()) ui->ListWidget->setColumnWidth(i, width.toInt()); @@ -526,7 +526,7 @@ void MainWindow::writeSettings() settings.endGroup(); settings.beginGroup("ListWidget"); - for (i = TreeItemDT::NR; i < TreeItemDT::COLUMNS; i++) + for (i = DiveTripModel::NR; i < DiveTripModel::COLUMNS; i++) if (!ui->ListWidget->isColumnHidden(i)) settings.setValue(QString("colwidth%1").arg(i), ui->ListWidget->columnWidth(i)); settings.endGroup(); -- cgit v1.2.3-70-g09d2