-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (25 loc) · 1.04 KB
/
main.cpp
File metadata and controls
34 lines (25 loc) · 1.04 KB
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
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QIcon>
#include <QQmlContext>
#include "PlayerController.h"
#include "AudioSearchModel.h"
#include "AudioInfo.h"
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
app.setWindowIcon(QIcon(":/assets/icons/app_icon.png"));
QQmlApplicationEngine engine;
AudioInfo audioInfo;
engine.rootContext()->setContextProperty("audioInfo", &audioInfo);
qmlRegisterSingletonType<PlayerController>("com.company.PlayerController", 1, 0,
"PlayerController", &PlayerController::create);
qmlRegisterSingletonType<AudioSearchModel>("com.company.AudioSearchModel", 1, 0,
"AudioSearchModel", &AudioSearchModel::create);
engine.loadFromModule("AudioPlayer", "Main");
QObject::connect(
&engine, &QQmlApplicationEngine::objectCreationFailed,
&app, []() {QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
return app.exec();
}