[Marble-commits] KDE/kdeedu/marble/src/plugins/render/navigation

Bastian Holst bastianholst at gmx.de
Wed Apr 28 17:37:34 CEST 2010


SVN commit 1120188 by bholst:

Preventing Marble Globe from flickering when zooming with NavigationFloatItem.
BUG: 232906


 M  +23 -4     NavigationFloatItem.cpp  
 M  +3 -1      NavigationFloatItem.h  


--- trunk/KDE/kdeedu/marble/src/plugins/render/navigation/NavigationFloatItem.cpp #1120187:1120188
@@ -120,6 +120,8 @@
                  this, SLOT( adjustForStill() ) );
         connect( m_navigationWidget->zoomSlider, SIGNAL( valueChanged( int ) ),
                  this, SLOT( updateButtons( int ) ) );
+        connect( m_navigationWidget->zoomSlider, SIGNAL( valueChanged(int) ),
+                 this, SLOT( setMarbleZoomValue(int) ) );
         // Other signal/slot connections will be initialized when the marble widget is known
     }
 }
@@ -175,8 +177,6 @@
             connect( m_navigationWidget->zoomOutButton, SIGNAL( clicked() ),
                      m_marbleWidget, SLOT( zoomOut() ) );
         
-            connect( m_navigationWidget->zoomSlider, SIGNAL(sliderMoved(int)),
-                     m_marbleWidget, SLOT(zoomView(int)));
             connect( m_navigationWidget->moveLeftButton, SIGNAL( clicked() ),
                      m_marbleWidget, SLOT( moveLeft() ) );
             connect( m_navigationWidget->moveRightButton, SIGNAL( clicked() ),
@@ -191,7 +191,7 @@
         }
         
         connect( m_marbleWidget->map(), SIGNAL(zoomChanged(int)),
-                 this, SLOT(zoomChanged(int)));
+                 this, SLOT( setZoomSliderValue( int ) ) );
         connect( m_marbleWidget, SIGNAL( themeChanged( QString ) ),
                  this, SLOT( selectTheme( QString ) ) );
         
@@ -201,13 +201,32 @@
     return AbstractFloatItem::eventFilter(object, e);
 }
 
-void NavigationFloatItem::zoomChanged(int level)
+void NavigationFloatItem::setZoomSliderValue(int level)
 {
     if( !( m_profiles & MarbleGlobal::SmallScreen ) ) {
         m_navigationWidget->zoomSlider->setValue(level);
     }
 }
 
+void NavigationFloatItem::setMarbleZoomValue( int level )
+{
+    // There exists a circular signal/slot connection between MarbleWidget and this widget's
+    // zoom slider. MarbleWidget prevents recursion, but it still loops one time unless
+    // disconnected here. 
+    // The circular signal/slot connection results into the Marble Globe flickering, when the
+    // zoom slider is used.
+
+    if( !m_marbleWidget ) {
+        return;
+    }
+
+    disconnect( m_marbleWidget->map(), SIGNAL( zoomChanged(int) ),
+                this, SLOT( setZoomSliderValue( int ) ) );
+    m_marbleWidget->zoomView( level );
+    connect( m_marbleWidget->map(), SIGNAL( zoomChanged(int) ),
+                this, SLOT( setZoomSliderValue( int ) ) );
+}
+
 void NavigationFloatItem::selectTheme(QString theme)
 {
     Q_UNUSED(theme);
--- trunk/KDE/kdeedu/marble/src/plugins/render/navigation/NavigationFloatItem.h #1120187:1120188
@@ -65,8 +65,10 @@
 
  private Q_SLOTS:
     /** Adjust slider value to zoom level provided */
-    void zoomChanged(int level);
+    void setZoomSliderValue( int level );
 
+    void setMarbleZoomValue( int level );
+
     /** Map theme was changed, adjust controls */
     void selectTheme( QString theme );
 


More information about the Marble-commits mailing list