xref: /OK3568_Linux_fs/app/forlinx/flapp/src/plugins/wifi/wifiview.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* WIFI 代理和模型显示接口*/
2 #ifndef WIFIITEMDELEGATE_H
3 #define WIFIITEMDELEGATE_H
4 #include <QAbstractItemDelegate>
5 #include <QAbstractListModel>
6 #include "wpaclicmd.h"
7 #include "hostapdcli.h"
8 
9 class WifiItemDelegate : public QAbstractItemDelegate
10 {
11 public:
12     WifiItemDelegate(QObject *parent = Q_NULLPTR);
13     virtual void paint(QPainter *painter,
14                        const QStyleOptionViewItem &option,
15                        const QModelIndex &index) const ;
16     virtual QSize sizeHint(const QStyleOptionViewItem &option,
17                            const QModelIndex &index) const ;
18     int getLevel(int singalLevel) const;
19 };
20 
21 class WifiModel: public  QAbstractListModel
22 {
23 public:
24     WifiModel(QObject *parent = Q_NULLPTR);
25     void setData(const QList<ScanInfo> &list);
26 
27     void setDataHostap(const QList<ScanInfoAp> &infos);
28     void lostConnectHoseap(const QString &ssid);
29 
30 protected:
31     int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
32     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
33     bool canFetchMore(const QModelIndex &parent) const;
34     void fetchMore(const QModelIndex &parent);
35 
36 private:
37     QList<ScanInfo> m_list;
38     int m_fixCount;
39     QString m_connName;
40 };
41 
42 #endif // WIFIITEMDELEGATE_H
43