File indexing completed on 2024-04-14 03:47:48
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2008 Henry de Valence <hdevalence@gmail.com> 0004 // SPDX-FileCopyrightText: 2011 Friedrich W. H. Kossebau <kossebau@kde.org> 0005 0006 #ifndef MARBLE_LATLONEDIT_H 0007 #define MARBLE_LATLONEDIT_H 0008 0009 #include <QWidget> 0010 0011 #include "GeoDataCoordinates.h" 0012 #include "MarbleGlobal.h" 0013 #include "marble_export.h" 0014 0015 namespace Marble 0016 { 0017 0018 class LatLonEditPrivate; 0019 0020 class MARBLE_EXPORT LatLonEdit : public QWidget 0021 { 0022 Q_OBJECT 0023 //FIXME: make the dimension enum work 0024 //Q_PROPERTY( qreal value READ value WRITE setValue ) 0025 //Q_PROPERTY( int dimension READ dimension WRITE setDimension ) 0026 0027 public: 0028 /** 0029 * @brief This enum is used to choose the dimension. 0030 */ 0031 enum Dimension { 0032 Latitude, ///< Latitude 0033 Longitude ///< Longitude 0034 }; 0035 0036 explicit LatLonEdit(QWidget *parent = nullptr, Dimension dimension = Longitude, 0037 GeoDataCoordinates::Notation notation = GeoDataCoordinates::DMS); 0038 ~LatLonEdit() override; 0039 qreal value() const; 0040 Dimension dimension() const; 0041 GeoDataCoordinates::Notation notation() const; 0042 public Q_SLOTS: 0043 void setValue(qreal newvalue); 0044 void setDimension( Dimension dimension ); 0045 void setNotation(GeoDataCoordinates::Notation notation); 0046 Q_SIGNALS: 0047 void valueChanged( qreal value ); 0048 private Q_SLOTS: 0049 void checkIntValueOverflow(); 0050 void checkUIntValueOverflow(); 0051 void checkFloatValueOverflow(); 0052 void onSignChanged(); 0053 private: 0054 // recalculates m_value based on spinboxes 0055 void recalculate(); 0056 private: 0057 LatLonEditPrivate * const d; 0058 }; 0059 0060 } 0061 0062 #endif