forked from SmartisanTech/Wrench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstrlistmodel.cpp
51 lines (46 loc) · 1.16 KB
/
strlistmodel.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "strlistmodel.h"
#include <QDebug>
#include <QFont>
#include <QBrush>
#include <lua.hpp>
#include <QSettings>
#include <QProcessEnvironment>
#include <QDir>
#include <QFile>
#include "selectoutput.h"
#include "vcard.h"
#include "bhj_help.hpp"
#include <QByteArray>
#include <QPixmap>
#include <algorithm>
StrlistModel::StrlistModel(const QStringList& strList, QObject *parent) :
FilteringModel(parent),
mDefaultAvatar("emojis/iphone-emoji/WRENCH.png")
{
mStrList = strList;
initHistory();
}
void StrlistModel::filterSelectedItems(const QStringList& split)
{
foreach (const QString& str, mStrList) {
int match = 1;
foreach(const QString& stem, split) {
if (str.indexOf(stem, 0, Qt::CaseInsensitive) >= 0) {
continue;
}
match = 0;
break;
}
if (match) {
SelectedItem si(str, str);
if (!mSelectedItemsRevMap.contains(si.displayText)) {
mSelectedItems << si;
mSelectedItemsRevMap[si.displayText] = si;
}
}
}
}
QString StrlistModel::getHistoryName()
{
return "strlist-history";
}