QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
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
122 void setPredefinedScales( const QVector< double > &scales );
123
124 signals:
125
130 void scaleChanged( double scale );
131
132 public slots:
133
138 void updateScales( const QStringList &scales = QStringList() );
139
145 void setScale( double scale );
146
153 void setMinScale( double scale );
154
164 void setNull();
165
166 protected:
167 void showPopup() override;
168
169 private slots:
170 void fixupScale();
171
172 private:
173 double mScale = 1.0;
174 double mMinScale = 0.0;
175 bool mAllowNull = false;
176};
177
178#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