[Qt] Added qt-qml-app example
This commit is contained in:
@@ -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:
|
||||
|
||||
8
Makefile
8
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-*
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
],
|
||||
'qtlibversion': '1.0.0',
|
||||
},
|
||||
'conditions': [
|
||||
['qt_version == 5', {
|
||||
'includes': [ 'qmlapp/qquickmapboxgl.gypi' ],
|
||||
}],
|
||||
],
|
||||
'includes': [
|
||||
'app/qmapboxgl.gypi',
|
||||
'../../mbgl.gypi',
|
||||
|
||||
17
platform/qt/qmlapp/main.cpp
Normal file
17
platform/qt/qmlapp/main.cpp
Normal file
@@ -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();
|
||||
}
|
||||
33
platform/qt/qmlapp/main.qml
Normal file
33
platform/qt/qmlapp/main.qml
Normal file
@@ -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
|
||||
}
|
||||
BIN
platform/qt/qmlapp/mapbox.png
Normal file
BIN
platform/qt/qmlapp/mapbox.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 248 KiB |
5
platform/qt/qmlapp/qml.qrc
Normal file
5
platform/qt/qmlapp/qml.qrc
Normal file
@@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>main.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
56
platform/qt/qmlapp/qquickmapboxgl.gypi
Normal file
56
platform/qt/qmlapp/qquickmapboxgl.gypi
Normal file
@@ -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)' ],
|
||||
}],
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user