Marble

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

KDE's Doxygen guidelines are available online.