Marble

TileLevelRangeWidget.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2
3#include "TileLevelRangeWidget.h"
4
5#include "ui_TileLevelRangeWidget.h"
6
7namespace Marble
8{
9
10class Q_DECL_HIDDEN TileLevelRangeWidget::Private
11{
12public:
13 explicit Private( QWidget * const parent );
14 Ui::TileLevelRangeWidget m_ui;
15};
16
17TileLevelRangeWidget::Private::Private( QWidget * const parent )
18{
19 m_ui.setupUi( parent );
20}
21
22TileLevelRangeWidget::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
34TileLevelRangeWidget::~TileLevelRangeWidget()
35{
36 delete d;
37}
38
39QSize TileLevelRangeWidget::sizeHint() const
40{
41 return size();
42}
43
44void 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
52void TileLevelRangeWidget::setDefaultLevel( int const level )
53{
54 d->m_ui.topSpinBox->setValue( level );
55 d->m_ui.bottomSpinBox->setValue( level );
56}
57
58int TileLevelRangeWidget::bottomLevel() const
59{
60 return d->m_ui.bottomSpinBox->value();
61}
62
63int TileLevelRangeWidget::topLevel() const
64{
65 return d->m_ui.topSpinBox->value();
66}
67
68void TileLevelRangeWidget::setMaximumTopLevel( int const level )
69{
70 d->m_ui.topSpinBox->setMaximum( level );
71}
72
73void TileLevelRangeWidget::setMinimumBottomLevel( int const level )
74{
75 d->m_ui.bottomSpinBox->setMinimum( level );
76}
77
78}
79
80#include "moc_TileLevelRangeWidget.cpp"
Binds a QML item to a specific geodetic location in screen coordinates.
QObject * parent() const const
T qobject_cast(QObject *object)
typedef WindowFlags
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:18:17 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.