QTfrontend/ui/widget/mapContainer.cpp
changeset 9739 c2c9dd2544b8
parent 9735 6312152d92ad
child 9744 1ee4842a9c86
--- a/QTfrontend/ui/widget/mapContainer.cpp	Mon Dec 02 23:20:07 2013 +0400
+++ b/QTfrontend/ui/widget/mapContainer.cpp	Mon Dec 02 20:25:15 2013 +0100
@@ -55,7 +55,9 @@
     mapgen(MAPGEN_REGULAR),
     m_previewSize(256, 128)
 {
-    m_previewDirty = true;
+    // don't show preview anything until first show event
+    m_previewEnabled = false;
+
     hhSmall.load(":/res/hh_small.png");
     hhLimit = 18;
     templateFilter = 0;
@@ -609,24 +611,20 @@
     updatePreview();
 }
 
-void HWMapContainer::paintEvent(QPaintEvent * event)
+void HWMapContainer::showEvent(QShowEvent * event)
 {
-    if (m_previewDirty)
+    if (!m_previewEnabled) {
+        m_previewEnabled = true;
         updatePreview();
-    QWidget::paintEvent(event);
+    }
+    QWidget::showEvent(event);
 }
 
 void HWMapContainer::updatePreview()
 {
-    // don't update preview if e.g. widget not being displayed
-    if (this->visibleRegion().isEmpty())
-    {
-        // but remember to update it later
-        m_previewDirty = true;
+    // abort if the widget isn't supposed to show anything yet
+    if (!m_previewEnabled)
         return;
-    }
-
-    m_previewDirty = false;
 
     if (pMap)
     {