From 413d8555afe748fb6ebd7e55a0a2192aace35dbb Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Tue, 22 Aug 2023 19:21:37 +0200 Subject: [PATCH] IBP Beacons: Resize the columns --- plugins/feature/map/mapibpbeacondialog.cpp | 16 ++++++++++++++++ plugins/feature/map/mapibpbeacondialog.h | 2 ++ plugins/feature/map/mapibpbeacondialog.ui | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/plugins/feature/map/mapibpbeacondialog.cpp b/plugins/feature/map/mapibpbeacondialog.cpp index 79a767bb7..ced27ea2d 100644 --- a/plugins/feature/map/mapibpbeacondialog.cpp +++ b/plugins/feature/map/mapibpbeacondialog.cpp @@ -42,6 +42,7 @@ MapIBPBeaconDialog::MapIBPBeaconDialog(MapGUI *gui, QWidget* parent) : ui->beacons->setItem(row, IBP_BEACON_COL_AZIMUTH, new QTableWidgetItem("")); ui->beacons->setItem(row, IBP_BEACON_COL_DISTANCE, new QTableWidgetItem("")); } + resizeTable(); updateTable(QTime::currentTime()); } @@ -50,6 +51,21 @@ MapIBPBeaconDialog::~MapIBPBeaconDialog() delete ui; } +// Fill table with a row of dummy data that will size the columns nicely +void MapIBPBeaconDialog::resizeTable(void) +{ + int row = ui->beacons->rowCount(); + ui->beacons->setRowCount(row + 1); + ui->beacons->setItem(row, IBP_BEACON_COL_FREQUENCY, new QTableWidgetItem("12.345")); + ui->beacons->setItem(row, IBP_BEACON_COL_CALLSIGN, new QTableWidgetItem("12345")); + ui->beacons->setItem(row, IBP_BEACON_COL_LOCATION, new QTableWidgetItem("1234567890123456")); + ui->beacons->setItem(row, IBP_BEACON_COL_DX_ENTITY, new QTableWidgetItem("1234567890123456")); + ui->beacons->setItem(row, IBP_BEACON_COL_AZIMUTH, new QTableWidgetItem("-123")); + ui->beacons->setItem(row, IBP_BEACON_COL_DISTANCE, new QTableWidgetItem("12345")); + ui->beacons->resizeColumnsToContents(); + ui->beacons->removeRow(row); +} + void MapIBPBeaconDialog::updateTable(QTime time) { AzEl azEl = *m_gui->getAzEl(); diff --git a/plugins/feature/map/mapibpbeacondialog.h b/plugins/feature/map/mapibpbeacondialog.h index 86bba5bd5..5381cf22f 100644 --- a/plugins/feature/map/mapibpbeacondialog.h +++ b/plugins/feature/map/mapibpbeacondialog.h @@ -45,6 +45,8 @@ private: QTimer m_timer; Ui::MapIBPBeaconDialog* ui; + void resizeTable(void); + enum BeaconCol { IBP_BEACON_COL_FREQUENCY, IBP_BEACON_COL_CALLSIGN, diff --git a/plugins/feature/map/mapibpbeacondialog.ui b/plugins/feature/map/mapibpbeacondialog.ui index 4ad54cf0b..ba637a5e7 100644 --- a/plugins/feature/map/mapibpbeacondialog.ui +++ b/plugins/feature/map/mapibpbeacondialog.ui @@ -6,7 +6,7 @@ 0 0 - 584 + 590 311