desktop: rename table widget in DiveComputerTab to "devices"

The custom TableView widget saves the table width on destruction.
For that, it uses the "objectName()". Since the table of the
DiveComputerTab was simply called "table" in the UI file, the
widths were saved in that generic section. To avoid future
name-conflicts, rename the widget to "devices".

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-11-07 12:58:27 +01:00 committed by Dirk Hohndel
parent 68b63534a3
commit 291768b63c
2 changed files with 8 additions and 7 deletions

View file

@ -6,12 +6,13 @@ TabDiveComputer::TabDiveComputer(QWidget *parent) : TabBase(parent)
{
ui.setupUi(this);
sortedModel.setSourceModel(&model);
ui.table->setModel(&sortedModel);
ui.table->view()->setSelectionBehavior(QAbstractItemView::SelectRows);
ui.table->view()->setSelectionMode(QAbstractItemView::SingleSelection);
ui.table->view()->setSortingEnabled(true);
ui.table->view()->sortByColumn(DiveComputerModel::MODEL, Qt::AscendingOrder);
connect(ui.table, &TableView::itemClicked, this, &TabDiveComputer::tableClicked);
ui.devices->setModel(&sortedModel);
ui.devices->view()->setSelectionBehavior(QAbstractItemView::SelectRows);
ui.devices->view()->setSelectionMode(QAbstractItemView::SingleSelection);
ui.devices->view()->setSortingEnabled(true);
ui.devices->view()->sortByColumn(DiveComputerModel::MODEL, Qt::AscendingOrder);
ui.devices->view()->horizontalHeader()->setStretchLastSection(true);
connect(ui.devices, &TableView::itemClicked, this, &TabDiveComputer::tableClicked);
}
void TabDiveComputer::updateData()

View file

@ -12,7 +12,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="TableView" name="table">
<widget class="TableView" name="devices">
<property name="title">
<string>Dive Computers</string>
</property>