This repository was archived by the owner on Apr 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathmain.cpp
More file actions
48 lines (38 loc) · 1.31 KB
/
main.cpp
File metadata and controls
48 lines (38 loc) · 1.31 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
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQuickView>
#include <QQmlContext>
#include "quickandroid.h"
#include "qadrawableprovider.h"
#include "qasystemdispatcher.h"
#include "automator.h"
#ifdef Q_OS_ANDROID
#include <QtAndroidExtras/QAndroidJniObject>
#include <QtAndroidExtras/QAndroidJniEnvironment>
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) {
Q_UNUSED(vm);
qDebug("NativeInterface::JNI_OnLoad()");
QASystemDispatcher::registerNatives();
return JNI_VERSION_1_6;
}
#endif
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQuickView view;
/* QuickAndroid Initialization */
view.engine()->addImportPath("qrc:///"); // Add QuickAndroid into the import path
QuickAndroid::registerTypes(); // It must be called before loaded any scene
/* End of QuickAndroid Initialization */
// Extra features:
QADrawableProvider* provider = new QADrawableProvider();
provider->setBasePath("qrc:///");
view.engine()->addImageProvider("drawable",provider);
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl(QStringLiteral("qrc:///main.qml")));
view.show();
/* Testing Code. Not needed for regular project */
Automator* automator = new Automator();
automator->start();
return app.exec();
}