mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-23 08:52:10 +01:00
81 lines
2.7 KiB
C
81 lines
2.7 KiB
C
|
/**
|
||
|
******************************************************************************
|
||
|
*
|
||
|
* @file uavobjecttreemodel.h
|
||
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||
|
* @brief
|
||
|
* @see The GNU Public License (GPL) Version 3
|
||
|
* @defgroup uavobjectbrowser
|
||
|
* @{
|
||
|
*
|
||
|
*****************************************************************************/
|
||
|
/*
|
||
|
* This program is free software; you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation; either version 3 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful, but
|
||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||
|
* for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License along
|
||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||
|
*/
|
||
|
|
||
|
#ifndef UAVOBJECTTREEMODEL_H
|
||
|
#define UAVOBJECTTREEMODEL_H
|
||
|
|
||
|
#include <QAbstractItemModel>
|
||
|
|
||
|
class TreeItem;
|
||
|
class TopTreeItem;
|
||
|
class UAVObject;
|
||
|
class UAVDataObject;
|
||
|
class UAVMetaObject;
|
||
|
class UAVObjectField;
|
||
|
class UAVObjectManager;
|
||
|
|
||
|
class UAVObjectTreeModel : public QAbstractItemModel
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
public:
|
||
|
explicit UAVObjectTreeModel(QObject *parent = 0);
|
||
|
|
||
|
QVariant data(const QModelIndex &index, int role) const;
|
||
|
bool setData(const QModelIndex &index, const QVariant & value, int role);
|
||
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||
|
QVariant headerData(int section, Qt::Orientation orientation,
|
||
|
int role = Qt::DisplayRole) const;
|
||
|
QModelIndex index(int row, int column,
|
||
|
const QModelIndex &parent = QModelIndex()) const;
|
||
|
QModelIndex parent(const QModelIndex &index) const;
|
||
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||
|
|
||
|
|
||
|
signals:
|
||
|
|
||
|
public slots:
|
||
|
void newObject(UAVObject *obj);
|
||
|
|
||
|
private:
|
||
|
void addDataObject(UAVDataObject *obj);
|
||
|
void addMetaObject(UAVMetaObject *obj, TreeItem *parent);
|
||
|
void addArrayField(UAVObjectField *field, TreeItem *parent);
|
||
|
|
||
|
void addSingleField(int index, UAVObjectField *field, TreeItem *parent);
|
||
|
void addInstance(UAVObject *obj, TreeItem *parent);
|
||
|
QString updateMode(quint8 updateMode);
|
||
|
void setupModelData(UAVObjectManager *objManager);
|
||
|
|
||
|
TreeItem *rootItem;
|
||
|
TopTreeItem *m_settingsTree;
|
||
|
TopTreeItem *m_nonSettingsTree;
|
||
|
|
||
|
};
|
||
|
|
||
|
#endif // UAVOBJECTTREEMODEL_H
|