aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/helloswift/main.cpp
blob: 1e7916395523ecf084ffbeda2ae8d00a35c4a4c2 (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
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#include <QGuiApplication>
#include <QStringList>

#include <qqmlengine.h>
#include <qqmlcontext.h>
#include <qqml.h>
#include <QtQuick/qquickitem.h>
#include <QtQuick/qquickview.h>

#include "greeter.h"
#include "hello-swift.h"

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

    QMetaType::registerConverter<std::string, QString>(&QString::fromStdString);

    Greeter greeter;

    QQuickView view;
    view.setResizeMode(QQuickView::SizeRootObjectToView);
    view.engine()->rootContext()->setContextProperty("greeter", &greeter);

    view.setSource(QUrl("qrc:/qt/qml/helloswift/main.qml"));
    view.show();

    return app.exec();
}

#include "moc_greeter.cpp"