[Marble-commits] KDE/kdeedu/marble/src/lib

Jens-Michael Hoffmann jensmh at gmx.de
Mon Apr 26 12:28:47 CEST 2010


SVN commit 1118974 by jmhoffmann:

TileLevelRangeWidget: Assure that maximum top level is not higher than then
current bottom level. Likewise for minimum bottom level: should not be
smaller than current top level.

 M  +18 -2     TileLevelRangeWidget.cpp  
 M  +4 -0      TileLevelRangeWidget.h  


--- trunk/KDE/kdeedu/marble/src/lib/TileLevelRangeWidget.cpp #1118973:1118974
@@ -34,8 +34,12 @@
     : QWidget( parent, f ),
       d( new Private( this ))
 {
+    // FIXME: rename min -> topLevel, max -> bottomLevel
     connect( d->m_ui.minSpinBox, SIGNAL( valueChanged( int )), SIGNAL( topLevelChanged( int )));
     connect( d->m_ui.maxSpinBox, SIGNAL( valueChanged( int )), SIGNAL( bottomLevelChanged( int )));
+
+    connect( d->m_ui.minSpinBox, SIGNAL( valueChanged( int )), SLOT( setMinimumBottomLevel( int )));
+    connect( d->m_ui.maxSpinBox, SIGNAL( valueChanged( int )), SLOT( setMaximumTopLevel( int )));
 }
 
 TileLevelRangeWidget::~TileLevelRangeWidget()
@@ -46,8 +50,10 @@
 void TileLevelRangeWidget::setAllowedTileLevelRange( int const minimumTileLevel,
                                                      int const maximumTileLevel )
 {
-    d->m_ui.minSpinBox->setRange( minimumTileLevel, maximumTileLevel );
-    d->m_ui.maxSpinBox->setRange( minimumTileLevel, maximumTileLevel );
+    d->m_ui.minSpinBox->setRange( minimumTileLevel, qMin( d->m_ui.maxSpinBox->value(),
+                                                          maximumTileLevel ));
+    d->m_ui.maxSpinBox->setRange( qMax( d->m_ui.minSpinBox->value(), minimumTileLevel ),
+                                  maximumTileLevel );
 }
 
 void TileLevelRangeWidget::setDefaultTileLevel( int const tileLevel )
@@ -66,6 +72,16 @@
     return d->m_ui.minSpinBox->value();
 }
 
+void TileLevelRangeWidget::setMaximumTopLevel( int const level )
+{
+    d->m_ui.minSpinBox->setMaximum( level );
 }
 
+void TileLevelRangeWidget::setMinimumBottomLevel( int const level )
+{
+    d->m_ui.maxSpinBox->setMinimum( level );
+}
+
+}
+
 #include "TileLevelRangeWidget.moc"
--- trunk/KDE/kdeedu/marble/src/lib/TileLevelRangeWidget.h #1118973:1118974
@@ -36,6 +36,10 @@
     int topLevel() const;
     int bottomLevel() const;
 
+ private Q_SLOTS:
+    void setMaximumTopLevel( int const );
+    void setMinimumBottomLevel( int const );
+
  Q_SIGNALS:
     void topLevelChanged( int );
     void bottomLevelChanged( int );


More information about the Marble-commits mailing list