-
Notifications
You must be signed in to change notification settings - Fork 0
/
liveloader.h
48 lines (34 loc) · 990 Bytes
/
liveloader.h
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
#ifndef LIVELOADER_H
#define LIVELOADER_H
#include <QObject>
#include <QQmlApplicationEngine>
#include <QQuickWindow>
#include "filewatcher.h"
class LiveLoader : public QObject
{
Q_OBJECT
Q_PROPERTY(QString errorMsg MEMBER m_errorMsg NOTIFY errorMsgChanged)
public:
explicit LiveLoader( QQmlApplicationEngine *engine,FileWatcher *fileWatcher, QObject *parent = nullptr);
Q_INVOKABLE void setFile(const QString &path);
// QString errorMsg() const
// { return m_errorMsg; }
public slots:
private:
QString m_errorMsg;
QUrl m_filePath;
bool created = false;
bool useWrapper = false;
QQmlApplicationEngine* m_engine;
QQuickWindow* m_currentWindow;
QQuickItem* m_errorWrapper;
FileWatcher* m_fileWatcher;
void loadQml();
void startWrapper();
signals:
void qmlLoaded();
void errorMsgChanged(QString &error);
public slots:
void handleQmlErrors(const QList<QQmlError> &qmlErrors);
};
#endif // LIVELOADER_H