QGIS API Documentation 3.41.0-Master (57ec4277f5e)
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:
40 QgsScaleComboBox( QWidget *parent SIP_TRANSFERTHIS = nullptr );
41
46 QString scaleString() const;
47
52 bool setScaleString( const QString &string );
53
59 double scale() const;
60
68 bool isNull() const;
69
76 double minScale() const { return mMinScale; }
77
85 static QString toString( double scale );
86
93 static double toDouble( const QString &string, bool *ok = nullptr );
94
102 void setAllowNull( bool allowNull );
103
111 bool allowNull() const;
112
121 void setPredefinedScales( const QVector<double> &scales );
122
123 signals:
124
129 void scaleChanged( double scale );
130
131 public slots:
132
137 void updateScales( const QStringList &scales = QStringList() );
138
144 void setScale( double scale );
145
152 void setMinScale( double scale );
153
163 void setNull();
164
165 protected:
166 void showPopup() override;
167
168 private slots:
169 void fixupScale();
170
171 private:
172 double mScale = 1.0;
173 double mMinScale = 0.0;
174 bool mAllowNull = false;
175};
176
177#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