diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-11-07 12:58:27 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-11-07 11:37:51 -0800 |
commit | 291768b63cd3443372d47ccc67858c398287d867 (patch) | |
tree | 4c75332db5c6974662657f834d0e08af3d5c8c7e /desktop-widgets/tab-widgets | |
parent | 68b63534a34a6e0b2af4a99919a439acd3d8be08 (diff) | |
download | subsurface-291768b63cd3443372d47ccc67858c398287d867.tar.gz |
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>
Diffstat (limited to 'desktop-widgets/tab-widgets')
-rw-r--r-- | desktop-widgets/tab-widgets/TabDiveComputer.cpp | 13 | ||||
-rw-r--r-- | desktop-widgets/tab-widgets/TabDiveComputer.ui | 2 |
2 files changed, 8 insertions, 7 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveComputer.cpp b/desktop-widgets/tab-widgets/TabDiveComputer.cpp index b8cd32cf4..104bee0c6 100644 --- a/desktop-widgets/tab-widgets/TabDiveComputer.cpp +++ b/desktop-widgets/tab-widgets/TabDiveComputer.cpp @@ -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() diff --git a/desktop-widgets/tab-widgets/TabDiveComputer.ui b/desktop-widgets/tab-widgets/TabDiveComputer.ui index 45492a52e..af9ba60c2 100644 --- a/desktop-widgets/tab-widgets/TabDiveComputer.ui +++ b/desktop-widgets/tab-widgets/TabDiveComputer.ui @@ -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> |