Branch data Line data Source code
1 : : #include <QtCore/QString>
2 : : #include <QtQml/QQmlApplicationEngine>
3 : : #include <QtQml/QQmlContext>
4 : : #include <QtWidgets/QApplication>
5 : :
6 : 0 : auto main(int argc, char *argv[]) -> int {
7 : 0 : QGuiApplication app(argc, argv);
8 : :
9 : 0 : QQmlApplicationEngine engine;
10 : :
11 : 0 : QString button_text = "Click me!";
12 : 0 : engine.rootContext()->setContextProperty("buttonText", button_text);
13 : :
14 : 0 : engine.load(QUrl(QStringLiteral("qrc:/examples/qt/qml/main.qml")));
15 : :
16 : 0 : return QGuiApplication::exec();
17 : 0 : }
|