mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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 <tcanabrava@kde.org>
This commit is contained in:
parent
14ccbbf6e8
commit
ae68ae38bb
5 changed files with 165 additions and 154 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue