mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Populate buddy completion model using CSV
While preparing to extend tags model to 'Buddy' field we populate completion list by splittng those fields by comma. Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
630eece8b2
commit
d2c95ddf75
1 changed files with 14 additions and 1 deletions
|
@ -32,7 +32,20 @@ void Class::updateModel() \
|
||||||
setStringList(list); \
|
setStringList(list); \
|
||||||
}
|
}
|
||||||
|
|
||||||
CREATE_UPDATE_METHOD(BuddyCompletionModel, buddy);
|
void BuddyCompletionModel::updateModel()
|
||||||
|
{
|
||||||
|
QSet<QString> set;
|
||||||
|
struct dive* dive;
|
||||||
|
int i = 0;
|
||||||
|
for_each_dive(i, dive){
|
||||||
|
QString buddy(dive->buddy);
|
||||||
|
foreach (const QString &value, buddy.split(",", QString::SkipEmptyParts)) {
|
||||||
|
set.insert(value.trimmed());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setStringList(set.toList());
|
||||||
|
}
|
||||||
|
|
||||||
CREATE_UPDATE_METHOD(DiveMasterCompletionModel, divemaster);
|
CREATE_UPDATE_METHOD(DiveMasterCompletionModel, divemaster);
|
||||||
CREATE_UPDATE_METHOD(LocationCompletionModel, location);
|
CREATE_UPDATE_METHOD(LocationCompletionModel, location);
|
||||||
CREATE_UPDATE_METHOD(SuitCompletionModel, suit);
|
CREATE_UPDATE_METHOD(SuitCompletionModel, suit);
|
||||||
|
|
Loading…
Add table
Reference in a new issue