diff options
author | Stefan Wildemann <gta04@metalstrolche.de> | 2019-01-29 00:01:46 +0100 |
---|---|---|
committer | Stefan Wildemann <gta04@metalstrolche.de> | 2019-01-29 00:01:46 +0100 |
commit | 1cc47990b8027e797fc2fcd8785203883e5fee8c (patch) | |
tree | 3d47f81636ffd61bea95013adf45c33d11ebfde6 /navit/graphics/qt5 | |
parent | 80979882b2ac8faecad3aa105b15fc8644e6d772 (diff) | |
download | navit-1cc47990b8027e797fc2fcd8785203883e5fee8c.tar.gz |
Fix:graphics_qt5:Dont't clear windows on fake resize
Sometimes it happeenes that resize is called, but the new size equals
the old one. This change keeps the contents intact if that happens.
Diffstat (limited to 'navit/graphics/qt5')
-rw-r--r-- | navit/graphics/qt5/QNavitQuick.cpp | 11 | ||||
-rw-r--r-- | navit/graphics/qt5/QNavitWidget.cpp | 10 |
2 files changed, 13 insertions, 8 deletions
diff --git a/navit/graphics/qt5/QNavitQuick.cpp b/navit/graphics/qt5/QNavitQuick.cpp index 6981f3af7..801827ebc 100644 --- a/navit/graphics/qt5/QNavitQuick.cpp +++ b/navit/graphics/qt5/QNavitQuick.cpp @@ -171,11 +171,14 @@ void QNavitQuick::geometryChanged(const QRectF& newGeometry, const QRectF& oldGe return; } if (graphics_priv->pixmap != NULL) { - delete graphics_priv->pixmap; - graphics_priv->pixmap = NULL; + if((width() != graphics_priv->pixmap->width()) || (height() != graphics_priv->pixmap->height())) { + delete graphics_priv->pixmap; + graphics_priv->pixmap = NULL; + } + } + if (graphics_priv->pixmap == NULL) { + graphics_priv->pixmap = new QPixmap(width(), height()); } - - graphics_priv->pixmap = new QPixmap(width(), height()); painter = new QPainter(graphics_priv->pixmap); if (painter != NULL) { QBrush brush; diff --git a/navit/graphics/qt5/QNavitWidget.cpp b/navit/graphics/qt5/QNavitWidget.cpp index 9c2b96505..6fcc8084a 100644 --- a/navit/graphics/qt5/QNavitWidget.cpp +++ b/navit/graphics/qt5/QNavitWidget.cpp @@ -95,11 +95,13 @@ void QNavitWidget::paintEvent(QPaintEvent* event) { void QNavitWidget::resizeEvent(QResizeEvent* event) { QPainter* painter = NULL; if (graphics_priv->pixmap != NULL) { - delete graphics_priv->pixmap; - graphics_priv->pixmap = NULL; + if((width() != graphics_priv->pixmap->width()) || (height() != graphics_priv->pixmap->height())) { + delete graphics_priv->pixmap; + graphics_priv->pixmap = NULL; + } + if (graphics_priv->pixmap == NULL) { + graphics_priv->pixmap = new QPixmap(size()); } - - graphics_priv->pixmap = new QPixmap(size()); painter = new QPainter(graphics_priv->pixmap); if (painter != NULL) { QBrush brush; |