QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
Loading...
Searching...
No Matches
qgsscalecombobox.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsscalecombobox.h
3 ------------------------
4 begin : January 7, 2012
5 copyright : (C) 2012 by Alexander Bruy
6 email : alexander dot bruy at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSSCALECOMBOBOX_H
19#define QGSSCALECOMBOBOX_H
20
21#include <QComboBox>
22#include "qgis_sip.h"
23#include "qgis_gui.h"
24
30class GUI_EXPORT QgsScaleComboBox : public QComboBox
31{
32 Q_OBJECT
33 Q_PROPERTY( double scale READ scale WRITE setScale NOTIFY scaleChanged )
34 Q_PROPERTY( double minScale READ minScale WRITE setMinScale )
35
36 public:
37
41 QgsScaleComboBox( QWidget *parent SIP_TRANSFERTHIS = nullptr );
42
47 QString scaleString() const;
48
53 bool setScaleString( const QString &string );
54
60 double scale() const;
61
69 bool isNull() const;
70
77 double minScale() const { return mMinScale; }
78
86 static QString toString( double scale );
87
94 static double toDouble( const QString &string, bool *ok = nullptr );
95
103 void setAllowNull( bool allowNull );
104
112 bool allowNull() const;
113
114 signals:
115
120 void scaleChanged( double scale );
121
122 public slots:
123
128 void updateScales( const QStringList &scales = QStringList() );
129
135 void setScale( double scale );
136
143 void setMinScale( double scale );
144
154 void setNull();
155
156 protected:
157 void showPopup() override;
158
159 private slots:
160 void fixupScale();
161
162 private:
163 double mScale = 1.0;
164 double mMinScale = 0.0;
165 bool mAllowNull = false;
166};
167
168#endif // QGSSCALECOMBOBOX_H
A combobox which lets the user select map scale from predefined list and highlights nearest to curren...
void scaleChanged(double scale)
Emitted when user has finished editing/selecting a new scale.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53