diff options
author | wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com> | 2019-03-12 16:47:27 +0800 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2019-03-25 11:21:09 +0000 |
commit | 259a07d696b455f22b13edcae107de67079036f3 (patch) | |
tree | 34e851277a1ef028f9143a506dbbf8df9cb33f0d | |
parent | 4b45ee3167d9218772d76555a65c5f2c673c72a8 (diff) |
Sort application display order
Sort application by application name with ascending order.
Change-Id: I778cc6a5a69496023abe4ecbab54bd686ce95594
Signed-off-by: wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
-rw-r--r-- | launcher/src/applicationmodel.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/launcher/src/applicationmodel.cpp b/launcher/src/applicationmodel.cpp index 258fac6..261e43e 100644 --- a/launcher/src/applicationmodel.cpp +++ b/launcher/src/applicationmodel.cpp @@ -71,7 +71,13 @@ void ApplicationModel::Private::addApp(QString icon, QString name, QString id) { _icon = "blank"; } - this->data.append(AppInfo(_icon, name, id)); + + int pos = 0; + for (pos = 0; pos < this->data.size(); ++pos) { + if (QString::compare(this->data.at(pos).name(), name, Qt::CaseInsensitive) > 0) + break; + } + this->data.insert(pos, AppInfo(_icon, name, id)); } void ApplicationModel::Private::removeApp(QString id) |