summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2019-02-26 23:39:45 -0800
committerMatt Ranostay <matt.ranostay@konsulko.com>2019-02-27 01:28:40 -0800
commit8ee667a77246f26e00e295e9edaaef6226468771 (patch)
treeca71b6de405bd98a81c4845013d2d9bbc91d2e57
parent287ad328be75011bd3be4caf46cbbe663dd0cba2 (diff)
libqtappfw: network: sort WiFI model by SSID
To allow ease of scrolling through WiFi discovery list by sorting on SSID. Change-Id: I1a8c369b4215177b93e6c584fd50f12d091de7d4 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r--network/network.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/network/network.cpp b/network/network.cpp
index 53a4898..0500547 100644
--- a/network/network.cpp
+++ b/network/network.cpp
@@ -15,6 +15,7 @@
*/
#include <QMetaEnum>
+#include <QSortFilterProxyModel>
#include <QtQml/QQmlEngine>
#include <vcard/vcard.h>
@@ -37,7 +38,12 @@ Network::Network (QUrl &url, QQmlContext *context, QObject * parent) :
m_mloop = new MessageEngine(url);
m_wifi = new WifiNetworkModel();
- context->setContextProperty("WifiNetworkModel", m_wifi);
+ QSortFilterProxyModel *m_model = new QSortFilterProxyModel();
+ m_model->setSourceModel(m_wifi);
+ m_model->setSortRole(WifiNetworkModel::WifiNetworkRoles::SsidRole);
+ m_model->setSortCaseSensitivity(Qt::CaseInsensitive);
+ m_model->sort(0);
+ context->setContextProperty("WifiNetworkModel", m_model);
QObject::connect(m_mloop, &MessageEngine::connected, this, &Network::onConnected);
QObject::connect(m_mloop, &MessageEngine::disconnected, this, &Network::onDisconnected);