File indexing completed on 2024-04-21 03:50:00
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 0003 #include "TileLevelRangeWidget.h" 0004 0005 #include "ui_TileLevelRangeWidget.h" 0006 0007 namespace Marble 0008 { 0009 0010 class Q_DECL_HIDDEN TileLevelRangeWidget::Private 0011 { 0012 public: 0013 explicit Private( QWidget * const parent ); 0014 Ui::TileLevelRangeWidget m_ui; 0015 }; 0016 0017 TileLevelRangeWidget::Private::Private( QWidget * const parent ) 0018 { 0019 m_ui.setupUi( parent ); 0020 } 0021 0022 TileLevelRangeWidget::TileLevelRangeWidget( QWidget * const parent, Qt::WindowFlags const f ) 0023 : QWidget( parent, f ), 0024 d( new Private( this )) 0025 { 0026 connect( d->m_ui.topSpinBox, SIGNAL(valueChanged(int)), SIGNAL(topLevelChanged(int))); 0027 connect( d->m_ui.bottomSpinBox, SIGNAL(valueChanged(int)), 0028 SIGNAL(bottomLevelChanged(int))); 0029 0030 connect( d->m_ui.topSpinBox, SIGNAL(valueChanged(int)), SLOT(setMinimumBottomLevel(int))); 0031 connect( d->m_ui.bottomSpinBox, SIGNAL(valueChanged(int)), SLOT(setMaximumTopLevel(int))); 0032 } 0033 0034 TileLevelRangeWidget::~TileLevelRangeWidget() 0035 { 0036 delete d; 0037 } 0038 0039 QSize TileLevelRangeWidget::sizeHint() const 0040 { 0041 return size(); 0042 } 0043 0044 void TileLevelRangeWidget::setAllowedLevelRange( int const minimumLevel, int const maximumLevel ) 0045 { 0046 d->m_ui.topSpinBox->setRange( minimumLevel, qMin( d->m_ui.bottomSpinBox->value(), 0047 maximumLevel )); 0048 d->m_ui.bottomSpinBox->setRange( qMax( d->m_ui.topSpinBox->value(), minimumLevel ), 0049 maximumLevel ); 0050 } 0051 0052 void TileLevelRangeWidget::setDefaultLevel( int const level ) 0053 { 0054 d->m_ui.topSpinBox->setValue( level ); 0055 d->m_ui.bottomSpinBox->setValue( level ); 0056 } 0057 0058 int TileLevelRangeWidget::bottomLevel() const 0059 { 0060 return d->m_ui.bottomSpinBox->value(); 0061 } 0062 0063 int TileLevelRangeWidget::topLevel() const 0064 { 0065 return d->m_ui.topSpinBox->value(); 0066 } 0067 0068 void TileLevelRangeWidget::setMaximumTopLevel( int const level ) 0069 { 0070 d->m_ui.topSpinBox->setMaximum( level ); 0071 } 0072 0073 void TileLevelRangeWidget::setMinimumBottomLevel( int const level ) 0074 { 0075 d->m_ui.bottomSpinBox->setMinimum( level ); 0076 } 0077 0078 } 0079 0080 #include "moc_TileLevelRangeWidget.cpp"