1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-17 13:51:47 -05:00

IBP Beacons: Resize the columns

This commit is contained in:
Daniele Forsi 2023-08-22 19:21:37 +02:00
parent 2ee8c6d137
commit 413d8555af
3 changed files with 19 additions and 1 deletions

View File

@ -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_AZIMUTH, new QTableWidgetItem(""));
ui->beacons->setItem(row, IBP_BEACON_COL_DISTANCE, new QTableWidgetItem("")); ui->beacons->setItem(row, IBP_BEACON_COL_DISTANCE, new QTableWidgetItem(""));
} }
resizeTable();
updateTable(QTime::currentTime()); updateTable(QTime::currentTime());
} }
@ -50,6 +51,21 @@ MapIBPBeaconDialog::~MapIBPBeaconDialog()
delete ui; 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) void MapIBPBeaconDialog::updateTable(QTime time)
{ {
AzEl azEl = *m_gui->getAzEl(); AzEl azEl = *m_gui->getAzEl();

View File

@ -45,6 +45,8 @@ private:
QTimer m_timer; QTimer m_timer;
Ui::MapIBPBeaconDialog* ui; Ui::MapIBPBeaconDialog* ui;
void resizeTable(void);
enum BeaconCol { enum BeaconCol {
IBP_BEACON_COL_FREQUENCY, IBP_BEACON_COL_FREQUENCY,
IBP_BEACON_COL_CALLSIGN, IBP_BEACON_COL_CALLSIGN,

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>584</width> <width>590</width>
<height>311</height> <height>311</height>
</rect> </rect>
</property> </property>