IBP Beacons: Resize the columns

pull/1778/head
Daniele Forsi 2023-08-22 19:21:37 +02:00
rodzic 2ee8c6d137
commit 413d8555af
3 zmienionych plików z 19 dodań i 1 usunięć

Wyświetl plik

@ -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();

Wyświetl plik

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

Wyświetl plik

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