summaryrefslogtreecommitdiff
path: root/src/main/main.cpp
blob: 27a48006403a27fffabb2f4d97a38a86c8960a74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <QGuiApplication>
#include <QQmlEngine>
#include <QQmlContext>
#include <QQmlComponent>

// networking
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QUrl>
#include <QUrlQuery>

// json parsing
#include <QJsonValue>
#include <QJsonDocument>
#include <QJsonObject>
#include <QVariantMap>
#include <QJsonArray>

// console output
#include <QDebug>
// #include <iostream>
#include "../model/Sport.h"
#include "../model/FilterModel.h"

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    QQmlEngine engine;
    QQmlContext *objectContext = new QQmlContext(engine.rootContext());

    SportModel model;
    model.request("ARC");
    FilterModel filter;
    filter.setSourceModel(&model);
    objectContext->setContextProperty("sports", &model);
    objectContext->setContextProperty("filter", &filter);

    QQmlComponent component(&engine, "qrc:/qt/qml/itat/res/gui/application.qml");
    QObject *object = component.create(objectContext);

    return app.exec();
}