Marble

LatLonBoxWidget.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2
3#include "LatLonBoxWidget.h"
4
5#include "GeoDataLatLonBox.h"
6#include "ui_LatLonBoxWidget.h"
7
8namespace Marble
9{
10
11class Q_DECL_HIDDEN LatLonBoxWidget::Private
12{
13public:
14 explicit Private( QWidget * const parent );
15 Ui::LatLonBoxWidget m_ui;
16};
17
18LatLonBoxWidget::Private::Private( QWidget * const parent )
19{
20 m_ui.setupUi( parent );
21}
22
23
24LatLonBoxWidget::LatLonBoxWidget( QWidget * const parent, Qt::WindowFlags const f )
25 : QWidget( parent, f ),
26 d( new Private( this ))
27{
28 // used for updating tiles count in DownloadRegionDialog
29 connect( d->m_ui.northSpinBox, SIGNAL(valueChanged(double)), SIGNAL(valueChanged()));
30 connect( d->m_ui.southSpinBox, SIGNAL(valueChanged(double)), SIGNAL(valueChanged()));
31 connect( d->m_ui.eastSpinBox, SIGNAL(valueChanged(double)), SIGNAL(valueChanged()));
32 connect( d->m_ui.westSpinBox, SIGNAL(valueChanged(double)), SIGNAL(valueChanged()));
33 // used for adjusting single step values
34 connect( d->m_ui.northSpinBox, SIGNAL(valueChanged(double)), SLOT(updateLatSingleStep()));
35 connect( d->m_ui.southSpinBox, SIGNAL(valueChanged(double)), SLOT(updateLatSingleStep()));
36 connect( d->m_ui.eastSpinBox, SIGNAL(valueChanged(double)), SLOT(updateLonSingleStep()));
37 connect( d->m_ui.westSpinBox, SIGNAL(valueChanged(double)), SLOT(updateLonSingleStep()));
38}
39
40LatLonBoxWidget::~LatLonBoxWidget()
41{
42 delete d;
43}
44
45GeoDataLatLonBox LatLonBoxWidget::latLonBox() const
46{
47 return GeoDataLatLonBox( d->m_ui.northSpinBox->value(), d->m_ui.southSpinBox->value(),
48 d->m_ui.eastSpinBox->value(), d->m_ui.westSpinBox->value(),
49 GeoDataCoordinates::Degree );
50}
51
52void LatLonBoxWidget::setLatLonBox( GeoDataLatLonBox const & latLonBox )
53{
54 d->m_ui.northSpinBox->setValue( latLonBox.north( GeoDataCoordinates::Degree ));
55 d->m_ui.southSpinBox->setValue( latLonBox.south( GeoDataCoordinates::Degree ));
56 d->m_ui.eastSpinBox->setValue( latLonBox.east( GeoDataCoordinates::Degree ));
57 d->m_ui.westSpinBox->setValue( latLonBox.west( GeoDataCoordinates::Degree ));
58}
59
60void LatLonBoxWidget::updateLatSingleStep()
61{
62 double const singleStep =
63 qAbs( d->m_ui.northSpinBox->value() - d->m_ui.southSpinBox->value() ) / 10.0;
64 d->m_ui.northSpinBox->setSingleStep( singleStep );
65 d->m_ui.southSpinBox->setSingleStep( singleStep );
66}
67
68void LatLonBoxWidget::updateLonSingleStep()
69{
70 double const singleStep =
71 qAbs( d->m_ui.eastSpinBox->value() - d->m_ui.westSpinBox->value() ) / 10.0;
72 d->m_ui.eastSpinBox->setSingleStep( singleStep );
73 d->m_ui.westSpinBox->setSingleStep( singleStep );
74}
75
76}
77
78#include "moc_LatLonBoxWidget.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 Fri Jun 21 2024 12:00:07 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.