mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-04 16:11:28 +00:00
8627f6fc4a
Add auto-sizing to the extra info table - resize the columns so that all rows are shown in full whenever the data is updated. Signed-off-by: Michael Keller <github@ike.ch>
36 lines
963 B
C++
36 lines
963 B
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#include "TabDiveExtraInfo.h"
|
|
#include "ui_TabDiveExtraInfo.h"
|
|
#include "core/dive.h"
|
|
#include "core/selection.h"
|
|
#include "qt-models/divecomputerextradatamodel.h"
|
|
|
|
TabDiveExtraInfo::TabDiveExtraInfo(MainTab *parent) :
|
|
TabBase(parent),
|
|
ui(new Ui::TabDiveExtraInfo()),
|
|
extraDataModel(new ExtraDataModel(this))
|
|
{
|
|
ui->setupUi(this);
|
|
ui->extraData->setModel(extraDataModel);
|
|
}
|
|
|
|
TabDiveExtraInfo::~TabDiveExtraInfo()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void TabDiveExtraInfo::updateData(const std::vector<dive *> &, dive *currentDive, int currentDC)
|
|
{
|
|
const struct divecomputer *currentdc = get_dive_dc(currentDive, currentDC);
|
|
if (currentdc)
|
|
extraDataModel->updateDiveComputer(currentdc);
|
|
|
|
ui->extraData->setVisible(false); // This will cause the resize to include rows outside the current viewport
|
|
ui->extraData->resizeColumnsToContents();
|
|
ui->extraData->setVisible(true);
|
|
}
|
|
|
|
void TabDiveExtraInfo::clear()
|
|
{
|
|
extraDataModel->clear();
|
|
}
|