|
@@ -0,0 +1,34 @@
|
|
|
+#include <QGuiApplication>
|
|
|
+#include <QObject>
|
|
|
+#include <QQmlApplicationEngine>
|
|
|
+#include <iostream>
|
|
|
+
|
|
|
+#include "qmlhandler.h"
|
|
|
+
|
|
|
+int main(int argc, char *argv[]) {
|
|
|
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
|
+
|
|
|
+ QGuiApplication app(argc, argv);
|
|
|
+
|
|
|
+ QQmlApplicationEngine engine;
|
|
|
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
|
|
+
|
|
|
+ if (engine.rootObjects().isEmpty())
|
|
|
+ return -1;
|
|
|
+
|
|
|
+ QMLHandler fooBar;
|
|
|
+
|
|
|
+ QObject *item =
|
|
|
+ engine.rootObjects().first()->findChild<QObject *>("connectbutton");
|
|
|
+ QObject *item2 =
|
|
|
+ engine.rootObjects().first()->findChild<QObject *>("disconnectbutton");
|
|
|
+
|
|
|
+ QObject::connect(item, SIGNAL(clicked()), &fooBar, SLOT(onClick()));
|
|
|
+ QObject::connect(item2, SIGNAL(clicked()), &fooBar, SLOT(onClick2()));
|
|
|
+
|
|
|
+ QObject::connect(&fooBar, SIGNAL(setStatusMessage(QVariant)),
|
|
|
+ engine.rootObjects().first(),
|
|
|
+ SLOT(setStatusMessage(QVariant)));
|
|
|
+
|
|
|
+ return app.exec();
|
|
|
+}
|