[Qt] Added viewport mode

Qt Quick requires third-party rendering codes to follow its standards
with regards to viewport transform. Qt 5.6 adds a 'mirrorVertically'
property but that only solves the solution for that version of Qt
onwards. Telling Mapbox GL core to flip the Y axis makes QQuickMapboxGL
item available for Qt 5.2 onwards.

Qt 'mirrorVertically' property documentation:
http://doc.qt.io/qt-5/qquickframebufferobject.html#mirrorVertically-prop

Fixes #4866.
This commit is contained in:
Bruno de Oliveira Abinader
2016-05-11 14:12:22 +03:00
parent c13dd32242
commit ae7a0ddea4
4 changed files with 28 additions and 6 deletions

View File

@@ -16,6 +16,7 @@ QQuickMapboxGLRenderer::QQuickMapboxGLRenderer()
settings.setAccessToken(qgetenv("MAPBOX_ACCESS_TOKEN"));
settings.setCacheDatabasePath("/tmp/mbgl-cache.db");
settings.setCacheDatabaseMaximumSize(20 * 1024 * 1024);
settings.setViewportMode(QMapboxGLSettings::FlippedYViewport);
m_map.reset(new QMapboxGL(nullptr, settings));
}