mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
Ref T80, improved completer
* no invalid combined codes in list * sort by rank * refresh completer strings when new codes are added
This commit is contained in:
@@ -177,11 +177,15 @@ namespace BlackGui
|
||||
|
||||
const QStringList &CDbAircraftIcaoSelectorComponent::completerStrings()
|
||||
{
|
||||
// done for performance reasons
|
||||
// init only once, future instance can share thte list
|
||||
// only to be called when data are read!
|
||||
static const QStringList cs(sGui->getWebDataServices()->getAircraftIcaoCodes().toCompleterStrings(true, true, true));
|
||||
return cs;
|
||||
const int c = sGui->getWebDataServices()->getAircraftIcaoCodesCount();
|
||||
if (c != m_completerStrings.size())
|
||||
{
|
||||
CAircraftIcaoCodeList icaos(sGui->getWebDataServices()->getAircraftIcaoCodes());
|
||||
icaos.removeInvalidCombinedCodes();
|
||||
icaos.sortByDesignatorManufacturerAndRank();
|
||||
m_completerStrings = icaos.toCompleterStrings(true, true, true);
|
||||
}
|
||||
return m_completerStrings;
|
||||
}
|
||||
|
||||
void CDbAircraftIcaoSelectorComponent::ps_codesRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
@@ -191,7 +195,7 @@ namespace BlackGui
|
||||
{
|
||||
if (count > 0)
|
||||
{
|
||||
QCompleter *c = new QCompleter(completerStrings(), this);
|
||||
QCompleter *c = new QCompleter(this->completerStrings(), this);
|
||||
c->setCaseSensitivity(Qt::CaseInsensitive);
|
||||
c->setCompletionMode(QCompleter::PopupCompletion);
|
||||
c->setMaxVisibleItems(10);
|
||||
|
||||
Reference in New Issue
Block a user