mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-21 23:55:13 -05:00
Merge pull request #1493 from srcejon/fix_sat_tracker_next_sort
Satellite Tracker: Fix sorting of next column
This commit is contained in:
commit
fcb156b5da
@ -1080,6 +1080,29 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// Handle sorting for next column, which can have times as HH:MM:SS or MM:SS
|
||||
class NextEventTableWidgetItem : public QTableWidgetItem
|
||||
{
|
||||
public:
|
||||
bool operator<(const QTableWidgetItem &other) const override
|
||||
{
|
||||
QString t1 = text();
|
||||
QString t2 = other.text();
|
||||
int t1Colons = t1.count(":");
|
||||
int t2Colons = t2.count(":");
|
||||
if (t1Colons == t2Colons)
|
||||
{
|
||||
QCollator coll;
|
||||
coll.setNumericMode(true);
|
||||
return coll.compare(t1, t2) < 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return t1Colons < t2Colons;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class NaturallySortedTableWidgetItem : public QTableWidgetItem
|
||||
{
|
||||
public:
|
||||
@ -1129,6 +1152,8 @@ void SatelliteTrackerGUI::updateTable(SatelliteState *satState)
|
||||
items[i] = new DateTimeSortedTableWidgetItem();
|
||||
else if ((i == SAT_COL_NAME) || (i == SAT_COL_NORAD_ID))
|
||||
items[i] = new QTableWidgetItem();
|
||||
else if (i == SAT_COL_TNE)
|
||||
items[i] = new NextEventTableWidgetItem();
|
||||
else
|
||||
items[i] = new NaturallySortedTableWidgetItem();
|
||||
items[i]->setToolTip(ui->satTable->horizontalHeaderItem(i)->toolTip());
|
||||
|
Loading…
Reference in New Issue
Block a user