From d55c6fb611c13ad3a1fd1469a46f10335727def6 Mon Sep 17 00:00:00 2001 From: Orangerot Date: Thu, 15 Aug 2024 01:24:36 +0200 Subject: feat(QJsonModel): QT Treeview shows JSON Model --- main.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 134229b..2413ced 100644 --- a/main.cpp +++ b/main.cpp @@ -23,10 +23,12 @@ // #include #include "QJsonModel.hpp" +#include +#include int main(int argc, char *argv[]) { - QGuiApplication app(argc, argv); + QApplication app(argc, argv); QQmlEngine engine; QQmlContext *objectContext = new QQmlContext(engine.rootContext()); @@ -86,6 +88,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(); -- cgit v1.2.3