summaryrefslogtreecommitdiff
path: root/platform/qt/app
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-05-13 15:35:54 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-05-13 17:29:36 +0300
commitc1dde52c73061a49d576454a9ab4739e72561ca6 (patch)
treee4dbac5c318e016db9eac0f73347d7325e0afdff /platform/qt/app
parentd36111abedf0d13d6078e6c75d55668bb8786141 (diff)
downloadqtlocation-mapboxgl-c1dde52c73061a49d576454a9ab4739e72561ca6.tar.gz
[Qt] Fix map aspect ratio
Take QGuiApplication::devicePixelRatio() in consideration when resizing the map. Fixes #4889.
Diffstat (limited to 'platform/qt/app')
-rw-r--r--platform/qt/app/mapwindow.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/platform/qt/app/mapwindow.cpp b/platform/qt/app/mapwindow.cpp
index 3e0b373db3..7a431f9801 100644
--- a/platform/qt/app/mapwindow.cpp
+++ b/platform/qt/app/mapwindow.cpp
@@ -149,13 +149,16 @@ void MapWindow::initializeGL()
void MapWindow::resizeGL(int w, int h)
{
- m_map.resize(QSize(w, h));
+ QSize size(w, h);
+#if QT_VERSION >= 0x050000
+ size /= qApp->devicePixelRatio();
+#endif
+ m_map.resize(size);
+ glViewport(0, 0, size.width(), size.height());
}
void MapWindow::paintGL()
{
- glViewport(0, 0, width(), height());
-
m_frameDraws++;
m_map.render();
}