-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.cpp
29 lines (19 loc) · 794 Bytes
/
main.cpp
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
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include "opencvimageprovider.h"
#include "videostreamer.h"
#include <QQmlContext>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
VideoStreamer videoStreamer;
OpencvImageProvider *liveImageProvider(new OpencvImageProvider);
engine.rootContext()->setContextProperty("VideoStreamer",&videoStreamer);
engine.rootContext()->setContextProperty("liveImageProvider",liveImageProvider);
engine.addImageProvider("live",liveImageProvider);
const QUrl url(QStringLiteral("qrc:/main.qml"));
engine.load(url);
QObject::connect(&videoStreamer,&VideoStreamer::newImage,liveImageProvider,&OpencvImageProvider::updateImage);
return app.exec();
}