Marble

MarbleNavigator.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2005-2007 Torsten Rahn <tackat@kde.org>
4// SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org>
5//
6
7#include "MarbleNavigator.h"
8
9#include <QtAlgorithms>
10
11#include "MarbleDebug.h"
12
13#include "ui_MarbleNavigator.h"
14
15namespace Marble
16{
17
18class MarbleNavigatorPrivate
19{
20public:
21 int m_minimumzoom;
22
23 Ui::MarbleNavigator uiWidget;
24};
25
27 : QWidget(parent)
28 , d(new MarbleNavigatorPrivate)
29
30{
31 d->uiWidget.setupUi(this);
32
33 d->m_minimumzoom = 950;
34
36
37 connect(d->uiWidget.goHomeButton, SIGNAL(clicked()), this, SIGNAL(goHome()));
38 connect(d->uiWidget.zoomSlider, SIGNAL(valueChanged(int)), this, SIGNAL(zoomChanged(int)));
39 connect(d->uiWidget.zoomInButton, SIGNAL(clicked()), this, SIGNAL(zoomIn()));
40 connect(d->uiWidget.zoomOutButton, SIGNAL(clicked()), this, SIGNAL(zoomOut()));
41
42 connect(d->uiWidget.moveLeftButton, SIGNAL(clicked()), this, SIGNAL(moveLeft()));
43 connect(d->uiWidget.moveRightButton, SIGNAL(clicked()), this, SIGNAL(moveRight()));
44 connect(d->uiWidget.moveUpButton, SIGNAL(clicked()), this, SIGNAL(moveUp()));
45 connect(d->uiWidget.moveDownButton, SIGNAL(clicked()), this, SIGNAL(moveDown()));
46}
47
48MarbleNavigator::~MarbleNavigator()
49{
50 delete d;
51}
52
54{
55 return d->m_minimumzoom;
56}
57
59{
60 // No infinite loops here
61 // if (zoomSlider->value() != zoom)
62 d->uiWidget.zoomSlider->setValue(zoom);
63 d->uiWidget.zoomSlider->setMinimum(d->m_minimumzoom);
64}
65
67{
68 // m_pSpacerFrame->setSizePolicy( QSizePolicy::Preferred,
69 // QSizePolicy::Fixed );
70 if (height() < 100) {
71 if (!d->uiWidget.zoomSlider->isHidden()) {
72 d->uiWidget.zoomSlider->hide();
73 d->uiWidget.m_pSpacerFrame->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
74 }
75 } else {
76 if (d->uiWidget.zoomSlider->isHidden()) {
77 d->uiWidget.zoomSlider->show();
78 d->uiWidget.m_pSpacerFrame->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
79 }
80 }
81}
82
83}
84
85#include "moc_MarbleNavigator.cpp"
This file contains the header for MarbleNavigator.
void zoomChanged(int zoom)
Signal emitted when the zoom slider has been moved.
int minimumZoom() const
Return the minimum zoom level set in the widget.
MarbleNavigator(QWidget *parent=nullptr)
Construct a new MarbleNavigator.
void resizeEvent(QResizeEvent *) override
Reimplementation of the resizeEvent() of the widget.
void moveRight()
Signal emitted when the Move Right button has been pressed.
void zoomIn()
Signal emitted when the Zoom In button has been pressed.
void moveDown()
Signal emitted when the Move Down button has been pressed.
void changeZoom(int zoom)
Sets the value of the slider.
void moveLeft()
Signal emitted when the Move Left button has been pressed.
void zoomOut()
Signal emitted when the Zoom Out button has been pressed.
void goHome()
Signal emitted when the Home button has been pressed.
void moveUp()
Signal emitted when the Move Up button has been pressed.
Binds a QML item to a specific geodetic location in screen coordinates.
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void setFocusPolicy(Qt::FocusPolicy policy)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 12:02:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.