summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml2
-rw-r--r--Makefile8
-rw-r--r--platform/qt/platform.gyp5
-rw-r--r--platform/qt/qmlapp/main.cpp17
-rw-r--r--platform/qt/qmlapp/main.qml33
-rw-r--r--platform/qt/qmlapp/mapbox.pngbin0 -> 253619 bytes
-rw-r--r--platform/qt/qmlapp/qml.qrc5
-rw-r--r--platform/qt/qmlapp/qquickmapboxgl.gypi56
-rw-r--r--scripts/main.mk3
9 files changed, 128 insertions, 1 deletions
diff --git a/.travis.yml b/.travis.yml
index 0e54ebcfa7..c0d2a03358 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -116,7 +116,7 @@ matrix:
env: FLAVOR=qt5 BUILDTYPE=Release _CXX=g++-4.9 _CC=gcc-4.9
addons: *qt5
script:
- - make qt-app
+ - make qt-app qt-qml-app
cache:
directories:
diff --git a/Makefile b/Makefile
index 182d14b76d..2b6212149c 100644
--- a/Makefile
+++ b/Makefile
@@ -188,6 +188,14 @@ qt-app:
run-qt-app: qt-app
$(RUN) PLATFORM=qt run-qt-app
+.PHONY: qt-qml-app
+qt-qml-app:
+ $(RUN) PLATFORM=qt Makefile/qt-qml-app
+
+.PHONY: run-qt-qml-app
+run-qt-qml-app: qt-qml-app
+ $(RUN) PLATFORM=qt run-qt-qml-app
+
.PHONY: test-qt
test-qt: node_modules/express
$(RUN) PLATFORM=qt test-*
diff --git a/platform/qt/platform.gyp b/platform/qt/platform.gyp
index dcf9169551..f73b920520 100644
--- a/platform/qt/platform.gyp
+++ b/platform/qt/platform.gyp
@@ -10,6 +10,11 @@
],
'qtlibversion': '1.0.0',
},
+ 'conditions': [
+ ['qt_version == 5', {
+ 'includes': [ 'qmlapp/qquickmapboxgl.gypi' ],
+ }],
+ ],
'includes': [
'app/qmapboxgl.gypi',
'../../mbgl.gypi',
diff --git a/platform/qt/qmlapp/main.cpp b/platform/qt/qmlapp/main.cpp
new file mode 100644
index 0000000000..df12663cae
--- /dev/null
+++ b/platform/qt/qmlapp/main.cpp
@@ -0,0 +1,17 @@
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+#include <qqml.h>
+
+#include <QQuickMapboxGL>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ qmlRegisterType<QQuickMapboxGL>("QQuickMapboxGL", 1, 0, "QQuickMapboxGL");
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+
+ return app.exec();
+}
diff --git a/platform/qt/qmlapp/main.qml b/platform/qt/qmlapp/main.qml
new file mode 100644
index 0000000000..b5b1fc3493
--- /dev/null
+++ b/platform/qt/qmlapp/main.qml
@@ -0,0 +1,33 @@
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Window 2.2
+import QtQuick.Dialogs 1.2
+import QQuickMapboxGL 1.0
+
+ApplicationWindow {
+ id: window
+ title: qsTr("Mapbox GL QML example")
+ width: 1024
+ height: 768
+ visible: true
+
+ Rectangle {
+ id: rect
+ width: 800
+ height: 600
+ anchors.centerIn: parent
+
+ NumberAnimation on x {
+ from: 0;
+ to: 100;
+ loops: Animation.Infinite;
+ duration: 1000;
+ }
+
+ QQuickMapboxGL {
+ id: map
+ anchors.fill: parent
+ } // QQuickMapboxGL
+
+ } // Rectangle
+}
diff --git a/platform/qt/qmlapp/mapbox.png b/platform/qt/qmlapp/mapbox.png
new file mode 100644
index 0000000000..4879089b5c
--- /dev/null
+++ b/platform/qt/qmlapp/mapbox.png
Binary files differ
diff --git a/platform/qt/qmlapp/qml.qrc b/platform/qt/qmlapp/qml.qrc
new file mode 100644
index 0000000000..5f6483ac33
--- /dev/null
+++ b/platform/qt/qmlapp/qml.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/platform/qt/qmlapp/qquickmapboxgl.gypi b/platform/qt/qmlapp/qquickmapboxgl.gypi
new file mode 100644
index 0000000000..c5f0aebb08
--- /dev/null
+++ b/platform/qt/qmlapp/qquickmapboxgl.gypi
@@ -0,0 +1,56 @@
+{
+ 'targets': [
+ {
+ 'target_name': 'qt-qml-app',
+ 'product_name': 'qquickmapboxgl',
+ 'type': 'executable',
+
+ 'includes': [
+ '../qt.gypi',
+ ],
+
+ 'dependencies': [
+ 'qt-lib',
+ ],
+
+ 'sources': [
+ 'main.cpp',
+ 'qml.qrc',
+ ],
+
+ 'include_dirs': [
+ '../include',
+ ],
+
+ 'variables': {
+ 'cflags': [
+ '<@(opengl_cflags)',
+ '<@(qt_core_cflags)',
+ '<@(qt_gui_cflags)',
+ '<@(qt_qml_cflags)',
+ '<@(qt_quick_cflags)',
+ '-fPIC',
+ ],
+ 'ldflags': [
+ '<@(opengl_ldflags)',
+ '<@(qt_core_ldflags)',
+ '<@(qt_gui_ldflags)',
+ '<@(qt_qml_ldflags)',
+ '<@(qt_quick_ldflags)',
+ ],
+ },
+
+ 'conditions': [
+ ['OS == "mac"', {
+ 'xcode_settings': {
+ 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags)' ],
+ 'OTHER_LDFLAGS': [ '<@(ldflags)' ],
+ },
+ }, {
+ 'cflags_cc': [ '<@(cflags)' ],
+ 'libraries': [ '<@(ldflags)' ],
+ }],
+ ],
+ },
+ ],
+}
diff --git a/scripts/main.mk b/scripts/main.mk
index aa1ce2b0c4..fa4ac8e19e 100644
--- a/scripts/main.mk
+++ b/scripts/main.mk
@@ -151,6 +151,9 @@ run-glfw-app:
run-qt-app:
cd $(PLATFORM_OUTPUT)/$(BUILDTYPE) && ./qmapboxgl
+run-qt-qml-app:
+ cd $(PLATFORM_OUTPUT)/$(BUILDTYPE) && ./qquickmapboxgl
+
run-valgrind-glfw-app:
cd $(PLATFORM_OUTPUT)/$(BUILDTYPE) && valgrind --leak-check=full --suppressions=../../../scripts/valgrind.sup ./mapbox-glfw