feat(QJsonModel): QT Treeview shows JSON Model
This commit is contained in:
parent
efeec3b99e
commit
d55c6fb611
9
main.cpp
9
main.cpp
|
@ -23,10 +23,12 @@
|
|||
// #include <iostream>
|
||||
|
||||
#include "QJsonModel.hpp"
|
||||
#include <QTreeView>
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QGuiApplication app(argc, argv);
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QQmlEngine engine;
|
||||
QQmlContext *objectContext = new QQmlContext(engine.rootContext());
|
||||
|
@ -87,6 +89,11 @@ int main(int argc, char *argv[])
|
|||
QQmlComponent component(&engine, "application.qml");
|
||||
QObject *object = component.create(objectContext);
|
||||
|
||||
|
||||
QTreeView * view = new QTreeView;
|
||||
view->setModel(model);
|
||||
view->show();
|
||||
|
||||
qDebug() << "Competitor:" << jsonObj["units"][0]["competitors"][0]["name"].toString();
|
||||
|
||||
delete reply;
|
||||
|
|
Loading…
Reference in a new issue