explorer.h Example File
sensor_explorer/import/explorer.h
#ifndef QSEONSOREXPLORER_H
#define QSEONSOREXPLORER_H
#include <QtQml/QtQml>
#include <QtQml/QQmlListProperty>
#include "sensoritem.h"
class QSensorExplorer : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<QSensorItem> availableSensors READ availableSensors NOTIFY availableSensorsChanged)
Q_PROPERTY(QSensorItem* selectedSensorItem READ selectedSensorItem WRITE setSelectedSensorItem NOTIFY selectedSensorItemChanged)
public:
QSensorExplorer(QObject* parent = 0);
virtual ~QSensorExplorer();
private:
QQmlListProperty<QSensorItem> availableSensors();
void loadSensors();
void setSelectedSensorItem(QSensorItem* selitem);
QSensorItem* selectedSensorItem();
Q_SIGNALS:
void availableSensorsChanged();
void selectedSensorItemChanged();
private:
QList<QSensorItem*> _availableSensors;
QSensorItem* _selectedSensorItem;
};
QML_DECLARE_TYPE(QSensorExplorer)
#endif // QSEONSOREXPLORER_H