summaryrefslogtreecommitdiff
path: root/navit/graphics
diff options
context:
space:
mode:
authorStefan Wildemann <gta04@metalstrolche.de>2019-01-29 00:01:46 +0100
committerStefan Wildemann <gta04@metalstrolche.de>2019-01-29 00:01:46 +0100
commit1cc47990b8027e797fc2fcd8785203883e5fee8c (patch)
tree3d47f81636ffd61bea95013adf45c33d11ebfde6 /navit/graphics
parent80979882b2ac8faecad3aa105b15fc8644e6d772 (diff)
downloadnavit-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')
-rw-r--r--navit/graphics/qt5/QNavitQuick.cpp11
-rw-r--r--navit/graphics/qt5/QNavitWidget.cpp10
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;