Commit fe2d1d79 authored by pixhawk's avatar pixhawk

Added Parameter interface

parent f0d81866
......@@ -32,6 +32,15 @@ This file is part of the PIXHAWK project
#include "ParamTreeItem.h"
ParamTreeItem::ParamTreeItem(int id, QString name, float value, ParamTreeItem* parent)
{
parentItem = parent;
itemData = QList<QVariant>();
itemData.append(id);
itemData.append(name);
itemData.append(value);
}
ParamTreeItem::ParamTreeItem(const QList<QVariant> &data, ParamTreeItem *parent)
{
parentItem = parent;
......
......@@ -40,6 +40,7 @@ This file is part of the PIXHAWK project
class ParamTreeItem
{
public:
ParamTreeItem(int id, QString name, float value, ParamTreeItem* parent = 0);
ParamTreeItem(const QList<QVariant> &data, ParamTreeItem *parent = 0);
~ParamTreeItem();
......
......@@ -33,6 +33,15 @@ This file is part of the PIXHAWK project
#include "ParamTreeItem.h"
#include "ParamTreeModel.h"
ParamTreeModel::ParamTreeModel(QObject *parent)
: QAbstractItemModel(parent)
{
QList<QVariant> rootData;
rootData << tr("ID") << tr("Parameter") << tr("Value");
rootItem = new ParamTreeItem(rootData);
//setupModelData(data.split(QString("\n")), rootItem);
}
ParamTreeModel::ParamTreeModel(const QString &data, QObject *parent)
: QAbstractItemModel(parent)
{
......
......@@ -42,6 +42,7 @@ class ParamTreeModel : public QAbstractItemModel
Q_OBJECT
public:
ParamTreeModel::ParamTreeModel(QObject *parent = 0);
ParamTreeModel(const QString &data, QObject *parent = 0);
~ParamTreeModel();
......@@ -55,6 +56,9 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
public slots:
void appendParam(int id, QString name, float value);
private:
void setupModelData(const QStringList &lines, ParamTreeItem *parent);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment