diff options
author | Wolfgang Beck <wolfgang.beck@nokia.com> | 2011-12-30 12:53:45 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-11 23:48:22 +0100 |
commit | 1a2c653e3ef82de04906e88bdf2ec5efada324f9 (patch) | |
tree | 6c08cc73ba134644fb7e0a02d918974c2d4dd2a2 /examples/sensors/sensor_explorer/import/explorer.h | |
parent | f9672df5ea9872f911eb0011012f829309e11e71 (diff) | |
download | qtsensors-1a2c653e3ef82de04906e88bdf2ec5efada324f9.tar.gz |
Convert sensor explorer example into a QML based application
Change-Id: If8628363c4998dabf85cad4277df088be23e3ff4
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Zsolt Simon <zsolt.simon@nokia.com>
Diffstat (limited to 'examples/sensors/sensor_explorer/import/explorer.h')
-rw-r--r-- | examples/sensors/sensor_explorer/import/explorer.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/examples/sensors/sensor_explorer/import/explorer.h b/examples/sensors/sensor_explorer/import/explorer.h new file mode 100644 index 0000000..b32e6bd --- /dev/null +++ b/examples/sensors/sensor_explorer/import/explorer.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSensors module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSEONSOREXPLORER_H +#define QSEONSOREXPLORER_H + +#include <QtDeclarative/qdeclarative.h> +#include <QtDeclarative/QDeclarativeListProperty> +#include "sensoritem.h" + +QT_BEGIN_NAMESPACE + +class QSensorExplorer : public QObject +{ + Q_OBJECT + Q_PROPERTY(QDeclarativeListProperty<QSensorItem> availableSensors READ availableSensors NOTIFY availableSensorsChanged) + Q_PROPERTY(QSensorItem* selectedSensorItem READ selectedSensorItem WRITE setSelectedSensorItem NOTIFY selectedSensorItemChanged) +public: + QSensorExplorer(QObject* parent = 0); + virtual ~QSensorExplorer(); + +private: + QDeclarativeListProperty<QSensorItem> availableSensors(); + void loadSensors(); + void setSelectedSensorItem(QSensorItem* selitem); + QSensorItem* selectedSensorItem(); + +Q_SIGNALS: + void availableSensorsChanged(); + void selectedSensorItemChanged(); + +private: + QList<QSensorItem*> _availableSensors; + QSensorItem* _selectedSensorItem; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QSensorExplorer) + +#endif // QSEONSOREXPLORER_H |