1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-10-31 15:07:12 -04:00

Merge pull request #2067 from dforsi/feature/sort-columns

[SIDAddChannelsDialog] Make columns sortable
This commit is contained in:
Edouard Griffiths 2024-04-15 07:37:48 +02:00 committed by GitHub
commit d7c461cad5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -53,6 +53,7 @@ SIDAddChannelsDialog::SIDAddChannelsDialog(SIDSettings *settings, QWidget* paren
} }
// Add row for each transmitter, with checkbox for each device // Add row for each transmitter, with checkbox for each device
ui->channels->setSortingEnabled(false);
for (int j = 0; j < VLFTransmitters::m_transmitters.size(); j++) for (int j = 0; j < VLFTransmitters::m_transmitters.size(); j++)
{ {
int row = ui->channels->rowCount(); int row = ui->channels->rowCount();
@ -60,6 +61,7 @@ SIDAddChannelsDialog::SIDAddChannelsDialog(SIDSettings *settings, QWidget* paren
ui->channels->setItem(row, COL_TX_NAME, new QTableWidgetItem(VLFTransmitters::m_transmitters[j].m_callsign)); ui->channels->setItem(row, COL_TX_NAME, new QTableWidgetItem(VLFTransmitters::m_transmitters[j].m_callsign));
ui->channels->setItem(row, COL_TX_FREQUENCY, new QTableWidgetItem(QString::number(VLFTransmitters::m_transmitters[j].m_frequency))); ui->channels->setItem(row, COL_TX_FREQUENCY, new QTableWidgetItem(QString::number(VLFTransmitters::m_transmitters[j].m_frequency)));
ui->channels->item(row, COL_TX_FREQUENCY)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
for (unsigned int i = 0; i < deviceSets.size(); i++) for (unsigned int i = 0; i < deviceSets.size(); i++)
{ {
@ -72,7 +74,8 @@ SIDAddChannelsDialog::SIDAddChannelsDialog(SIDSettings *settings, QWidget* paren
} }
} }
} }
ui->channels->sortItems(COL_TX_FREQUENCY);
ui->channels->setSortingEnabled(true);
ui->channels->resizeColumnsToContents(); ui->channels->resizeColumnsToContents();
} }