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, &QSpinBox::valueChanged, this, &TileLevelRangeWidget::topLevelChanged);
27 connect(d->m_ui.bottomSpinBox, &QSpinBox::valueChanged, this, &TileLevelRangeWidget::bottomLevelChanged);
28
29 connect(d->m_ui.topSpinBox, &QSpinBox::valueChanged, this, &TileLevelRangeWidget::setMinimumBottomLevel);
30 connect(d->m_ui.bottomSpinBox, &QSpinBox::valueChanged, this, &TileLevelRangeWidget::setMaximumTopLevel);
31}
32
33TileLevelRangeWidget::~TileLevelRangeWidget()
34{
35 delete d;
36}
37
38QSize TileLevelRangeWidget::sizeHint() const
39{
40 return size();
41}
42
43void TileLevelRangeWidget::setAllowedLevelRange(int const minimumLevel, int const maximumLevel)
44{
45 d->m_ui.topSpinBox->setRange(minimumLevel, qMin(d->m_ui.bottomSpinBox->value(), maximumLevel));
46 d->m_ui.bottomSpinBox->setRange(qMax(d->m_ui.topSpinBox->value(), minimumLevel), maximumLevel);
47}
48
49void TileLevelRangeWidget::setDefaultLevel(int const level)
50{
51 d->m_ui.topSpinBox->setValue(level);
52 d->m_ui.bottomSpinBox->setValue(level);
53}
54
55int TileLevelRangeWidget::bottomLevel() const
56{
57 return d->m_ui.bottomSpinBox->value();
58}
59
60int TileLevelRangeWidget::topLevel() const
61{
62 return d->m_ui.topSpinBox->value();
63}
64
65void TileLevelRangeWidget::setMaximumTopLevel(int const level)
66{
67 d->m_ui.topSpinBox->setMaximum(level);
68}
69
70void TileLevelRangeWidget::setMinimumBottomLevel(int const level)
71{
72 d->m_ui.bottomSpinBox->setMinimum(level);
73}
74
75}
76
77#include "moc_TileLevelRangeWidget.cpp"
Binds a QML item to a specific geodetic location in screen coordinates.
QObject * parent() const const
void valueChanged(int i)
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 Sat Dec 21 2024 17:04:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.