SHARE
TWEET

Untitled

a guest Jan 12th, 2017 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #ifndef HTUNNELVIEWERMODEL_H
  2. #define HTUNNELVIEWERMODEL_H
  3.  
  4. #include <QObject>
  5. #include <QtQml/QQmlEngine>
  6.  
  7. #include <QQmlHelpers>
  8. #include <QAbstractListModel>
  9. #include <QMap>
  10. #include <QTimer>
  11. #include "toolbox.h"
  12.  
  13. class HTunnelViewerModel : public QAbstractListModel
  14. {
  15.     Q_OBJECT
  16.     SINGELTON(HTunnelViewerModel)
  17.  
  18.  
  19.     QML_WRITABLE_PROPERTY(bool, setEnabled)
  20.  
  21. public:
  22.     explicit HTunnelViewerModel(QObject *parent = 0);
  23.     ~HTunnelViewerModel();
  24.  
  25.     static void declareQML();
  26.  
  27.     enum HTunnelViewerRole {
  28.         Address = Qt::UserRole + 1,
  29.         ActiveConnections,
  30.         SpeedUp,
  31.         SpeedDown
  32.      };
  33.  
  34.  
  35.     Q_ENUM(HTunnelViewerRole)
  36.  
  37.  
  38.  
  39.     /// QAbstractListModel
  40.     virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const override;
  41.     virtual int rowCount(const QModelIndex & parent = QModelIndex()) const override;
  42.     virtual QHash<int, QByteArray> roleNames() const  override;
  43.  
  44. private:
  45.     QTimer m_updateTimer;
  46. };
  47.  
  48. #endif // HTUNNELVIEWERMODEL_H
RAW Paste Data
Top