3
3
#include < QQmlContext>
4
4
#include < QQuickStyle>
5
5
6
+ #ifdef PRODUCTION
7
+ #define PRODUCTION_BUILD true
8
+ #else
9
+ #define PRODUCTION_BUILD false
10
+ #endif
11
+
6
12
int main (int argc, char *argv[]) {
7
13
// Disable qml cache, or it would crash in development
8
- qputenv (" QML_DISABLE_DISK_CACHE" , " true" );
14
+ qputenv (" QML_DISABLE_DISK_CACHE" , PRODUCTION_BUILD ? " false " : " true" );
9
15
10
16
// This has the app draw at HiDPI scaling on HiDPI displays, usually two
11
17
// pixels for every one logical pixel
@@ -21,18 +27,27 @@ int main(int argc, char *argv[]) {
21
27
// - <QtGui/QGuiApplication> (on other platform)
22
28
QtQuickControlsApplication app (argc, argv);
23
29
24
- // Do not automatically quit on last window closed
30
+ // Do not automatically quit on last window closed in development
25
31
// We need this for hot-reloading
32
+ // in macOS, always set this to false
33
+ #ifdef Q_OS_MAC
26
34
app.setQuitOnLastWindowClosed (false );
27
-
35
+ #else
36
+ app.setQuitOnLastWindowClosed (PRODUCTION_BUILD);
37
+ #endif
28
38
// setup app basic metadata
29
39
app.setOrganizationName (" Podzim" );
30
40
app.setOrganizationDomain (" podzim.co" );
31
41
app.setApplicationName (" Launcher" );
32
42
33
43
QQmlApplicationEngine engine;
34
44
engine.addImportPath (QStringLiteral (" qrc:/" ));
35
- engine.load (QUrl (QLatin1String (" qrc:/main.qml" )));
45
+
46
+ if (PRODUCTION_BUILD) {
47
+ engine.load (QUrl (QLatin1String (" qrc:/index.qml" )));
48
+ } else {
49
+ engine.load (QUrl (QLatin1String (" qrc:/react-qml/main.qml" )));
50
+ }
36
51
37
52
return app.exec ();
38
53
}
0 commit comments