summaryrefslogtreecommitdiffstats
path: root/src/imports/wifi/qwifinetworklistmodel.h
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@digia.com>2014-03-17 10:52:24 +0100
committerGatis Paeglis <gatis.paeglis@digia.com>2014-03-18 17:05:07 +0200
commit9767def438c4265319c3eef99e0531ee5164054e (patch)
tree5cbc1a577689f263477da549aae39cc530f92a68 /src/imports/wifi/qwifinetworklistmodel.h
parentcb7775bf6eac1140cb40131efe87cb9fbc9b78ba (diff)
Rename misleading class name
The API is: ListView { model: wifiManager.networks } currently if user calls print(wifiManager.networks) it will print: QWifiNetworkList The docs of ListView states that model property expects a subclass of QAbstractListModel. QWifiNetworkList sounds like a subclass of QList which is misleading. This patch renames the class to QWifiNetworkListModel. This does not change the public API (doesn't brake compatibility in any way), just improves the documentation of library. Task-number: QTEE-445 Change-Id: I71f07cb22617f3a7f41a0403d1c63c4357310325 Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Diffstat (limited to 'src/imports/wifi/qwifinetworklistmodel.h')
-rw-r--r--src/imports/wifi/qwifinetworklistmodel.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/imports/wifi/qwifinetworklistmodel.h b/src/imports/wifi/qwifinetworklistmodel.h
new file mode 100644
index 0000000..2827c8a
--- /dev/null
+++ b/src/imports/wifi/qwifinetworklistmodel.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use the contact form at
+** http://qt.digia.com/
+**
+** This file is part of Qt Enterprise Embedded.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** the contact form at http://qt.digia.com/
+**
+****************************************************************************/
+#ifndef QWIFINETWORKLISTMODEL_H
+#define QWIFINETWORKLISTMODEL_H
+
+#include <QtCore/QAbstractListModel>
+#include <QtCore/QList>
+
+#include "qwifinetwork.h"
+
+class QWifiManager;
+
+class QWifiNetworkListModel : public QAbstractListModel
+{
+ Q_OBJECT
+
+public:
+
+ QWifiNetworkListModel(QWifiManager *manager);
+
+ void parseScanResults(const QByteArray &data);
+
+ QWifiNetwork *networkForSSID(const QByteArray &ssid, int *pos);
+
+ int rowCount(const QModelIndex &) const { return m_networks.size(); }
+ QVariant data(const QModelIndex &index, int role) const;
+
+ QHash<int,QByteArray> roleNames() const;
+
+private:
+ QWifiManager *m_manager;
+ QList<QWifiNetwork *> m_networks;
+};
+
+#endif // QWIFINETWORKLISTMODEL_H