-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
36 lines (31 loc) · 1.14 KB
/
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
30
31
32
33
34
35
36
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include "readdata.h"
#include <QQmlContext>
#include <QtQml>
#include "getalbumimg.h"
#include <QUrl>
int main(int argc, char *argv[])
{
ReadData readData;
GetAlbumImg getAlbumImg;
qmlRegisterSingletonInstance<ReadData>("SendData",1,0,"ReadData",ReadData::getInstance());
qmlRegisterType<ReadData>("SendData",1,0,"ReadData");
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
QQuickView view;
engine.load(QUrl(QStringLiteral("main.qml")));
QObject::connect(
&engine,
&QQmlApplicationEngine::objectCreationFailed,
&app,
[]() { QCoreApplication::exit(-1); },
Qt::QueuedConnection);
engine.rootContext()->setContextProperty("SendData",&readData);
engine.rootContext()->setContextProperty("mediaPlayer_I",&getAlbumImg);
view.rootContext()->setContextProperty("mediaPlayer_I",&getAlbumImg);
view.setSource(QUrl("file://main.qml"));
engine.loadFromModule("FFMusic", "Main");
//engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}