-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
56 lines (43 loc) · 1.69 KB
/
Copy pathmain.cpp
File metadata and controls
56 lines (43 loc) · 1.69 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QSettings>
#include <QtDebug>
#include <QColor>
#include "lib/util.h"
#include "lib/qt_camera.h"
#include "lib/camera_list_model.h"
#include "lib/font_list_model.h"
#include "lib/setting_manager.h"
int main(int argc, char* argv[])
{
#if defined(Q_OS_WIN)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
// Qt GUI 어플리케이션 초기화
QGuiApplication app(argc, argv);
// QQmlApplicationEngine 객체 생성
QQmlApplicationEngine engine;
// Cam 객체 생성
QtCamera qt_camera;
//database.applicationFontFamilies(database.styles("Arial").first());
// QQmlContext에 Cam 객체 등록
engine.rootContext()->setContextProperty("qt_camera", &qt_camera);
// 연결된 카메라 목록을 관리하는 모델 객체 생성
CameraListModel camera_list_model;
// 연결된 카메라 목록을 관리하는 모델 객체 생성
FontListModel font_list_model;
// 설정 관리자 객체 생성
SettingManager setting_manager;
// QQmlContext에 모델 객체 및 설정 관리자 객체 등록
engine.rootContext()->setContextProperty("camera_list_model", &camera_list_model);
engine.rootContext()->setContextProperty("font_list_model", &font_list_model);
engine.rootContext()->setContextProperty("setting_manager", &setting_manager);
// QML 파일 로드
engine.load(QUrl(QStringLiteral("qrc:/qt/qml/processcam2/main.qml")));
// QML 파일 로드에 실패한 경우 종료
if (engine.rootObjects().isEmpty())
return -1;
// 어플리케이션 이벤트 루프 실행
return app.exec();
}