xmlRpcModel.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, C. Dornhege, University of Freiburg
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright notice, this
9  * list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  * * Neither the name of the University of Freiburg nor the names
14  * of its contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef XML_RPC_MODEL_H
30 #define XML_RPC_MODEL_H
31 
32 #include <QAbstractItemModel>
33 #include "xmlRpcTreeItem.h"
34 
36 
43 class XmlRpcModel : public QAbstractItemModel
44 {
45  Q_OBJECT
46 
47  public:
48  XmlRpcModel(XmlRpc::XmlRpcValue* rootData, const std::string & rootPath, ros::NodeHandle* nh);
49  virtual ~XmlRpcModel();
50 
51  QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
52  QModelIndex parent(const QModelIndex & index) const;
53 
54  QVariant data(const QModelIndex & index, int role) const;
55  Qt::ItemFlags flags(const QModelIndex & index) const;
56  QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
57 
59  int rowCount(const QModelIndex & parent = QModelIndex()) const;
60  int columnCount(const QModelIndex & parent = QModelIndex()) const;
61 
62  bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
63 
64  unsigned int getMaxDisplayLength() const { return _maxDisplayLength; }
65  void setMaxDisplayLength(unsigned int l) { _maxDisplayLength = l; }
66 
67  private:
69 
70  unsigned int _maxDisplayLength;
71 };
72 
73 #endif
74 
unsigned int _maxDisplayLength
Definition: xmlRpcModel.h:70
A wrapper around the XmlRpcValue including a parent pointer and convenience functions for the qt mode...
XmlRpcModel(XmlRpc::XmlRpcValue *rootData, const std::string &rootPath, ros::NodeHandle *nh)
Definition: xmlRpcModel.cpp:31
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: xmlRpcModel.cpp:42
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
XmlRpcTreeItem * _root
Definition: xmlRpcModel.h:68
QModelIndex parent(const QModelIndex &index) const
Definition: xmlRpcModel.cpp:68
int rowCount(const QModelIndex &parent=QModelIndex()) const
should return the number of children for a parent item
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
int columnCount(const QModelIndex &parent=QModelIndex()) const
Qt::ItemFlags flags(const QModelIndex &index) const
Definition: xmlRpcModel.cpp:83
void setMaxDisplayLength(unsigned int l)
Definition: xmlRpcModel.h:65
QAbstractItemModel for XmlRpcValues.
Definition: xmlRpcModel.h:43
QVariant data(const QModelIndex &index, int role) const
virtual ~XmlRpcModel()
Definition: xmlRpcModel.cpp:37
unsigned int getMaxDisplayLength() const
Definition: xmlRpcModel.h:64


qt_paramedit
Author(s): Christian Dornhege
autogenerated on Mon Feb 28 2022 23:37:51