-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathlivecoding.h
More file actions
54 lines (40 loc) · 1.27 KB
/
Copy pathlivecoding.h
File metadata and controls
54 lines (40 loc) · 1.27 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
#ifndef APPLICATIONHELPERS_H
#define APPLICATIONHELPERS_H
#include <QObject>
#include <QQmlEngine>
class LiveCoding : public QObject {
Q_OBJECT
Q_PROPERTY(QString currentLanguage READ currentLanguage CONSTANT)
public:
explicit LiveCoding(QQmlEngine* engine, QObject* parent = nullptr);
static QObject* qmlSingletonProvider(QQmlEngine* engine, QJSEngine* scriptEngine)
{
Q_UNUSED(engine)
Q_UNUSED(scriptEngine)
return new LiveCoding(engine);
}
/**
* Opens an URL with the default application provided by the system.
* E.g. a text file will be opened by the default text editor.
*/
Q_INVOKABLE bool openUrlWithDefaultApplication(const QUrl& url) const;
/**
* Clear QML component cache of the main QQmlEngine.
*/
Q_INVOKABLE void clearQmlComponentCache() const;
/**
* Holds the currently active UI language.
*/
QString currentLanguage() const;
/**
* Sets the new UI language. Changes take effect after a restart.
*/
Q_INVOKABLE void setLanguage(const QString& language);
/**
* Restarts the application.
*/
Q_INVOKABLE void restartApplication();
private:
QQmlEngine* m_engine;
}; // class ApplicationHelpers
#endif // APPLICATIONHELPERS_H