File indexing completed on 2024-03-24 03:52:30
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2005-2007 Torsten Rahn <tackat@kde.org> 0004 // SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org> 0005 // 0006 0007 // 0008 // This widget is a control box for the Marble widget. 0009 // 0010 0011 #ifndef MARBLE_MARBLENAVIGATOR_H 0012 #define MARBLE_MARBLENAVIGATOR_H 0013 0014 0015 #include <QWidget> 0016 0017 #include "marble_export.h" 0018 0019 0020 /** @file 0021 * This file contains the header for MarbleNavigator 0022 * 0023 * @author Torsten Rahn <tackat@kde.org> 0024 * @author Inge Wallin <inge@lysator.liu.se> 0025 */ 0026 0027 namespace Marble 0028 { 0029 0030 class MarbleNavigatorPrivate; 0031 0032 /** 0033 * @short A widget class that contains simple controls for a 0034 * MarbleWidget. 0035 * 0036 * This widget lets the user control an instance of MarbleWidget. The 0037 * user can control panning and zooming as well as returning to a 0038 * predefined view called the 'Home' position. You cannot change the 0039 * Home position from the MarbleNavigator, though. 0040 * 0041 * @see MarbleWidget 0042 */ 0043 0044 class MARBLE_EXPORT MarbleNavigator : public QWidget 0045 { 0046 Q_OBJECT 0047 0048 public: 0049 /** 0050 * @brief Construct a new MarbleNavigator 0051 * @param parent the parent widget 0052 */ 0053 explicit MarbleNavigator(QWidget *parent = nullptr); 0054 ~MarbleNavigator() override; 0055 0056 /** 0057 * @brief Return the minimum zoom level set in the widget. 0058 * @return the minimum zoom level set in the widget. 0059 */ 0060 int minimumZoom() const; 0061 0062 Q_SIGNALS: 0063 /** 0064 * @brief Signal emitted when the Home button has been pressed. 0065 */ 0066 void goHome(); 0067 /** 0068 * @brief Signal emitted when the Zoom In button has been pressed. 0069 */ 0070 void zoomIn(); 0071 /** 0072 * @brief Signal emitted when the Zoom Out button has been pressed. 0073 */ 0074 void zoomOut(); 0075 /** 0076 * @brief Signal emitted when the zoom slider has been moved. 0077 * @param zoom The new zoom value. 0078 */ 0079 void zoomChanged(int zoom); 0080 0081 /** 0082 * @brief Signal emitted when the Move Left button has been pressed. 0083 */ 0084 void moveLeft(); 0085 /** 0086 * @brief Signal emitted when the Move Right button has been pressed. 0087 */ 0088 void moveRight(); 0089 /** 0090 * @brief Signal emitted when the Move Up button has been pressed. 0091 */ 0092 void moveUp(); 0093 /** 0094 * @brief Signal emitted when the Move Down button has been pressed. 0095 */ 0096 void moveDown(); 0097 //void centerOn(const QModelIndex&); 0098 0099 public Q_SLOTS: 0100 /** 0101 * @brief Sets the value of the slider. 0102 * @param zoom The new zoom value. 0103 * 0104 * This slot should be called when the zoom value is changed from 0105 * the widget itself, e.g. by using the scroll wheel. It sets the 0106 * value of the slider, but nothing more. In particular it 0107 * doesn't emit the zoomChanged signal. 0108 */ 0109 void changeZoom(int zoom); 0110 0111 protected: 0112 /** 0113 * @brief Reimplementation of the resizeEvent() of the widget. 0114 * 0115 * If the MarbleNavigator gets shrunk enough, the slider will be 0116 * hidden, leaving only the Zoom Up and Zoom Down buttons. 0117 */ 0118 void resizeEvent ( QResizeEvent * ) override; 0119 0120 private: 0121 Q_DISABLE_COPY( MarbleNavigator ) 0122 MarbleNavigatorPrivate * const d; 0123 }; 0124 0125 } 0126 0127 #endif