mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
Ref T442, utility functions for logically sorting by suffix
This commit is contained in:
@@ -114,11 +114,13 @@ namespace BlackGui
|
||||
QStandardItemModel *model = new QStandardItemModel();
|
||||
if (this->isEmpty()) { return model; }
|
||||
model->setColumnCount(4);
|
||||
QMap<QString, int> types = this->container().getSuffixes();
|
||||
for (const QString &type : types.keys())
|
||||
const CAtcStationList atcStations = this->container().sortedByAtcSuffixSortOrderAndDistance();
|
||||
const QStringList types = atcStations.getSuffixes();
|
||||
for (const QString &type : types)
|
||||
{
|
||||
// ownership of QStandardItem is taken by model
|
||||
QStandardItem *typeFolderFirstColumn = new QStandardItem(CCallsign::atcSuffixToIcon(type).toQIcon(), type);
|
||||
typeFolderFirstColumn->setEditable(false);
|
||||
QList<QStandardItem *> typeFolderRow { typeFolderFirstColumn };
|
||||
model->invisibleRootItem()->appendRow(typeFolderRow);
|
||||
CAtcStationList stations = this->container().findBySuffix(type);
|
||||
@@ -150,6 +152,14 @@ namespace BlackGui
|
||||
Q_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
|
||||
// make not editable
|
||||
for (QStandardItem *si : stationRow)
|
||||
{
|
||||
si->setEditable(false);
|
||||
}
|
||||
|
||||
// add all items
|
||||
typeFolderFirstColumn->appendRow(stationRow);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user