Qt Json Tree Model
1386e400fd
Fix: Root TreeItem (Object and Array) are not editable |
||
---|---|---|
.gitignore | ||
LICENSE | ||
main.cpp | ||
qjsonmodel.cpp | ||
qjsonmodel.h | ||
QJsonModel.pro | ||
qjsonmodel.py | ||
README.md | ||
screen.png |
QJsonModel
QJsonModel is a json tree model class for Qt5/C++11/Python based on QAbstractItemModel. QJsonModel is under MIT License.
Usage C++
Add qjsonmodel.cpp
and qjsonmodel.h
into your project.
QJsonModel * model = new QJsonModel;
QTreeView * view = new QTreeView;
view->setModel(model);
model->load("example.json")
Usage Python
Add qjsonmodel.py
to your PYTHONPATH
.
$ pip install Qt.py
import json
import qjsonmodel
model = QJsonModel()
view = QTreeView()
view.setModel(model)
with open("example.json") as f:
model.load(json.load(f))