-
Notifications
You must be signed in to change notification settings - Fork 4
/
application_manager.hpp
63 lines (43 loc) · 1.14 KB
/
application_manager.hpp
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
57
58
59
60
61
62
63
#ifndef QML_application_manager_H
#define QML_application_manager_H
#include <QGuiApplication>
#include <QLibraryInfo>
#include <QQmlApplicationEngine>
#include <QQmlComponent>
#include <QQmlContext>
#include <QQuickItem>
#include <QQuickView>
#include <QSurfaceFormat>
#include <QtQml>
#include "jlcxx/jlcxx.hpp"
#include "julia_api.hpp"
namespace qmlwrap
{
/// Manage creation and destruction of the application and the QML engine,
class ApplicationManager
{
public:
// Singleton implementation
static ApplicationManager& instance();
JuliaAPI* julia_api();
~ApplicationManager();
// Init the app with a new QQmlApplicationEngine
QQmlApplicationEngine* init_qmlapplicationengine();
QQmlEngine* init_qmlengine();
QQmlEngine* get_qmlengine();
QQuickView* init_qquickview();
void cleanup();
QQmlContext* root_context();
// Blocking call to exec, running the Qt event loop
void exec();
static void process_events();
static jl_module_t* m_qml_mod;
private:
ApplicationManager();
void check_no_engine();
void set_engine(QQmlEngine* e);
QQmlEngine* m_engine = nullptr;
QQmlContext* m_root_ctx = nullptr;
};
}
#endif