mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-05 00:21:29 +00:00
291768b63c
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>
33 lines
949 B
C++
33 lines
949 B
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#include "TabDiveComputer.h"
|
|
#include "ui_TabDiveExtraInfo.h"
|
|
|
|
TabDiveComputer::TabDiveComputer(QWidget *parent) : TabBase(parent)
|
|
{
|
|
ui.setupUi(this);
|
|
sortedModel.setSourceModel(&model);
|
|
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()
|
|
{
|
|
}
|
|
|
|
void TabDiveComputer::clear()
|
|
{
|
|
}
|
|
|
|
void TabDiveComputer::tableClicked(const QModelIndex &index)
|
|
{
|
|
if (!index.isValid())
|
|
return;
|
|
|
|
if (index.column() == DiveComputerModel::REMOVE)
|
|
sortedModel.remove(index);
|
|
}
|