![]() |
Galaxis Codebase
1.0.0
Team Galaxis software stack for the Carolo Cup 2023 - ROS2 based software
|
#include <jsontreemodel.h>


Public Member Functions | |
| JsonTreeModel (const QStringList &headers, const nlohmann::json &data, QObject *parent=0) | |
| ~JsonTreeModel () | |
| QVariant | data (const QModelIndex &index, int role) 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 |
| Qt::ItemFlags | flags (const QModelIndex &index) const |
| bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) |
| bool | setHeaderData (int section, Qt::Orientation orientation, const QVariant &value, int role=Qt::EditRole) |
| bool | insertColumns (int position, int columns, const QModelIndex &parent=QModelIndex()) |
| bool | removeColumns (int position, int columns, const QModelIndex &parent=QModelIndex()) |
| bool | insertRows (int position, int rows, const QModelIndex &parent=QModelIndex()) |
| bool | removeRows (int position, int rows, const QModelIndex &parent=QModelIndex()) |
| JsonTreeItem * | getRootItem () |
Private Member Functions | |
| void | setupModelData (const nlohmann::json &lines, JsonTreeItem *parent) |
| QString | getTypeString (value_t vType) |
| JsonTreeItem * | getItem (const QModelIndex &index) const |
Private Attributes | |
| JsonTreeItem * | rootItem |
Definition at line 13 of file jsontreemodel.h.
| JsonTreeModel::JsonTreeModel | ( | const QStringList & | headers, |
| const nlohmann::json & | data, | ||
| QObject * | parent = 0 |
||
| ) |
Definition at line 8 of file jsontreemodel.cpp.
References data(), rootItem, and setupModelData().

| JsonTreeModel::~JsonTreeModel | ( | ) |
| int JsonTreeModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
Definition at line 25 of file jsontreemodel.cpp.
References JsonTreeItem::columnCount(), and rootItem.
Referenced by JsonEditorMain::insertTreeChild().


| QVariant JsonTreeModel::data | ( | const QModelIndex & | index, |
| int | role | ||
| ) | const |
Definition at line 30 of file jsontreemodel.cpp.
References JsonTreeItem::data(), getItem(), and index().
Referenced by JsonTreeModel(), and setupModelData().


| Qt::ItemFlags JsonTreeModel::flags | ( | const QModelIndex & | index | ) | const |
Definition at line 43 of file jsontreemodel.cpp.
References index().

|
private |
Definition at line 51 of file jsontreemodel.cpp.
References index(), and rootItem.
Referenced by data(), index(), insertRows(), parent(), removeRows(), rowCount(), and setData().


| JsonTreeItem * JsonTreeModel::getRootItem | ( | ) |
Definition at line 260 of file jsontreemodel.cpp.
References rootItem.
Referenced by JsonEditorMain::formatCode().

|
private |
Definition at line 265 of file jsontreemodel.cpp.
Referenced by setupModelData().

| QVariant JsonTreeModel::headerData | ( | int | section, |
| Qt::Orientation | orientation, | ||
| int | role = Qt::DisplayRole |
||
| ) | const |
Definition at line 60 of file jsontreemodel.cpp.
References JsonTreeItem::data(), and rootItem.

| QModelIndex JsonTreeModel::index | ( | int | row, |
| int | column, | ||
| const QModelIndex & | parent = QModelIndex() |
||
| ) | const |
Definition at line 69 of file jsontreemodel.cpp.
References JsonTreeItem::child(), getItem(), and parent().
Referenced by data(), flags(), getItem(), JsonEditorMain::insertTreeChild(), parent(), and setData().


| bool JsonTreeModel::insertColumns | ( | int | position, |
| int | columns, | ||
| const QModelIndex & | parent = QModelIndex() |
||
| ) |
Definition at line 83 of file jsontreemodel.cpp.
References JsonTreeItem::insertColumns(), parent(), and rootItem.

| bool JsonTreeModel::insertRows | ( | int | position, |
| int | rows, | ||
| const QModelIndex & | parent = QModelIndex() |
||
| ) |
Definition at line 94 of file jsontreemodel.cpp.
References JsonTreeItem::columnCount(), getItem(), JsonTreeItem::insertChildren(), parent(), and rootItem.

| QModelIndex JsonTreeModel::parent | ( | const QModelIndex & | index | ) | const |
Definition at line 106 of file jsontreemodel.cpp.
References JsonTreeItem::childNumber(), getItem(), index(), JsonTreeItem::parent(), and rootItem.
Referenced by index(), insertColumns(), insertRows(), removeColumns(), removeRows(), rowCount(), and setupModelData().


| bool JsonTreeModel::removeColumns | ( | int | position, |
| int | columns, | ||
| const QModelIndex & | parent = QModelIndex() |
||
| ) |
Definition at line 120 of file jsontreemodel.cpp.
References JsonTreeItem::columnCount(), parent(), JsonTreeItem::removeColumns(), removeRows(), rootItem, and rowCount().

| bool JsonTreeModel::removeRows | ( | int | position, |
| int | rows, | ||
| const QModelIndex & | parent = QModelIndex() |
||
| ) |
Definition at line 134 of file jsontreemodel.cpp.
References getItem(), parent(), and JsonTreeItem::removeChildren().
Referenced by removeColumns().


| int JsonTreeModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
Definition at line 146 of file jsontreemodel.cpp.
References JsonTreeItem::childCount(), getItem(), and parent().
Referenced by removeColumns().


| bool JsonTreeModel::setData | ( | const QModelIndex & | index, |
| const QVariant & | value, | ||
| int | role = Qt::EditRole |
||
| ) |
Definition at line 153 of file jsontreemodel.cpp.
References getItem(), index(), and JsonTreeItem::setData().
Referenced by JsonEditorMain::insertTreeChild().


| bool JsonTreeModel::setHeaderData | ( | int | section, |
| Qt::Orientation | orientation, | ||
| const QVariant & | value, | ||
| int | role = Qt::EditRole |
||
| ) |
Definition at line 168 of file jsontreemodel.cpp.
References rootItem, and JsonTreeItem::setData().

|
private |
Definition at line 182 of file jsontreemodel.cpp.
References JsonTreeItem::child(), JsonTreeItem::childCount(), JsonTreeItem::columnCount(), data(), getTypeString(), JsonTreeItem::insertChildren(), parent(), rootItem, and JsonTreeItem::setData().
Referenced by JsonTreeModel().


|
private |
Definition at line 55 of file jsontreemodel.h.
Referenced by columnCount(), getItem(), getRootItem(), headerData(), insertColumns(), insertRows(), JsonTreeModel(), parent(), removeColumns(), setHeaderData(), setupModelData(), and ~JsonTreeModel().