[Qt] Added qt-qml-app example

This commit is contained in:
Bruno de Oliveira Abinader
2016-04-27 13:12:42 +03:00
parent 72bcad210d
commit a083fcbd77
9 changed files with 128 additions and 1 deletions

View File

@@ -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:

View File

@@ -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-*

View File

@@ -10,6 +10,11 @@
],
'qtlibversion': '1.0.0',
},
'conditions': [
['qt_version == 5', {
'includes': [ 'qmlapp/qquickmapboxgl.gypi' ],
}],
],
'includes': [
'app/qmapboxgl.gypi',
'../../mbgl.gypi',

View 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();
}

View 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
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

View File

@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
</qresource>
</RCC>

View 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)' ],
}],
],
},
],
}

View File

@@ -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