[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

@@ -14,10 +14,6 @@
QQuickMapboxGL::QQuickMapboxGL(QQuickItem *parent_)
: QQuickFramebufferObject(parent_)
{
#if QT_VERSION >= 0x050600
// FIXME: https://github.com/mapbox/mapbox-gl-native/issues/4866
setMirrorVertically(true);
#endif
}
QQuickMapboxGL::~QQuickMapboxGL()
@@ -166,7 +162,7 @@ QColor QQuickMapboxGL::color() const
void QQuickMapboxGL::pan(int dx, int dy)
{
m_pan += QPointF(dx, dy);
m_pan += QPointF(dx, -dy);
m_syncState |= PanNeedsSync;
update();