Marble

TileLevelRangeWidget.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 
3 #include "TileLevelRangeWidget.h"
4 
5 #include "ui_TileLevelRangeWidget.h"
6 
7 namespace Marble
8 {
9 
10 class Q_DECL_HIDDEN TileLevelRangeWidget::Private
11 {
12 public:
13  explicit Private( QWidget * const parent );
14  Ui::TileLevelRangeWidget m_ui;
15 };
16 
17 TileLevelRangeWidget::Private::Private( QWidget * const parent )
18 {
19  m_ui.setupUi( parent );
20 }
21 
22 TileLevelRangeWidget::TileLevelRangeWidget( QWidget * const parent, Qt::WindowFlags const f )
23  : QWidget( parent, f ),
24  d( new Private( this ))
25 {
26  connect( d->m_ui.topSpinBox, SIGNAL(valueChanged(int)), SIGNAL(topLevelChanged(int)));
27  connect( d->m_ui.bottomSpinBox, SIGNAL(valueChanged(int)),
28  SIGNAL(bottomLevelChanged(int)));
29 
30  connect( d->m_ui.topSpinBox, SIGNAL(valueChanged(int)), SLOT(setMinimumBottomLevel(int)));
31  connect( d->m_ui.bottomSpinBox, SIGNAL(valueChanged(int)), SLOT(setMaximumTopLevel(int)));
32 }
33 
34 TileLevelRangeWidget::~TileLevelRangeWidget()
35 {
36  delete d;
37 }
38 
39 QSize TileLevelRangeWidget::sizeHint() const
40 {
41  return size();
42 }
43 
44 void TileLevelRangeWidget::setAllowedLevelRange( int const minimumLevel, int const maximumLevel )
45 {
46  d->m_ui.topSpinBox->setRange( minimumLevel, qMin( d->m_ui.bottomSpinBox->value(),
47  maximumLevel ));
48  d->m_ui.bottomSpinBox->setRange( qMax( d->m_ui.topSpinBox->value(), minimumLevel ),
49  maximumLevel );
50 }
51 
52 void TileLevelRangeWidget::setDefaultLevel( int const level )
53 {
54  d->m_ui.topSpinBox->setValue( level );
55  d->m_ui.bottomSpinBox->setValue( level );
56 }
57 
58 int TileLevelRangeWidget::bottomLevel() const
59 {
60  return d->m_ui.bottomSpinBox->value();
61 }
62 
63 int TileLevelRangeWidget::topLevel() const
64 {
65  return d->m_ui.topSpinBox->value();
66 }
67 
68 void TileLevelRangeWidget::setMaximumTopLevel( int const level )
69 {
70  d->m_ui.topSpinBox->setMaximum( level );
71 }
72 
73 void TileLevelRangeWidget::setMinimumBottomLevel( int const level )
74 {
75  d->m_ui.bottomSpinBox->setMinimum( level );
76 }
77 
78 }
79 
80 #include "moc_TileLevelRangeWidget.cpp"
typedef WindowFlags
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Oct 2 2023 03:52:10 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.