| QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
    | 
A combobox which lets the user select map scale from predefined list and highlights nearest to current scale value. More...
#include <qgsscalecombobox.h>

| Public Slots | |
| void | setMinScale (double scale) | 
| Set the minimum allowed scale. | |
| void | setNull () | 
| Sets the combo box to the null value. | |
| void | setScale (double scale) | 
| Set the selected scale from a double. | |
| void | updateScales (const QStringList &scales=QStringList()) | 
| Sets the list of predefined scales to show in the combobox. | |
| Signals | |
| void | scaleChanged (double scale) | 
| Emitted when user has finished editing/selecting a new scale. | |
| Public Member Functions | |
| QgsScaleComboBox (QWidget *parent=nullptr) | |
| Constructor for QgsScaleComboBox. | |
| bool | allowNull () const | 
| Returns trueif the combobox can be set to a NULL value. | |
| bool | isNull () const | 
| Returns trueif the combo box is currently set to a "null" value. | |
| double | minScale () const | 
| Returns the minimum scale, or 0 if no minimum scale set. | |
| double | scale () const | 
| Returns the selected scale as a double. | |
| QString | scaleString () const | 
| Returns the selected scale as a string, e.g. | |
| void | setAllowNull (bool allowNull) | 
| Sets whether the scale combobox can be set to a NULL value. | |
| bool | setScaleString (const QString &string) | 
| Set the selected scale from a string, e.g. | |
| Static Public Member Functions | |
| static double | toDouble (const QString &string, bool *ok=nullptr) | 
| Helper function to convert a scale string to double. | |
| static QString | toString (double scale) | 
| Helper function to convert a scale double to scale string. | |
| Protected Member Functions | |
| void | showPopup () override | 
| Properties | |
| double | minScale | 
| double | scale | 
A combobox which lets the user select map scale from predefined list and highlights nearest to current scale value.
Definition at line 30 of file qgsscalecombobox.h.
| QgsScaleComboBox::QgsScaleComboBox | ( | QWidget * | parent = nullptr | ) | 
Constructor for QgsScaleComboBox.
Definition at line 27 of file qgsscalecombobox.cpp.
| bool QgsScaleComboBox::allowNull | ( | ) | const | 
Returns true if the combobox can be set to a NULL value. 
Definition at line 276 of file qgsscalecombobox.cpp.
| bool QgsScaleComboBox::isNull | ( | ) | const | 
Returns true if the combo box is currently set to a "null" value. 
Definition at line 169 of file qgsscalecombobox.cpp.
| 
 | inline | 
Returns the minimum scale, or 0 if no minimum scale set.
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. Any scale lower than the minimum scale will automatically be converted to the minimum scale. Except for 0 which is always allowed.
Definition at line 77 of file qgsscalecombobox.h.
| double QgsScaleComboBox::scale | ( | ) | const | 
Returns the selected scale as a double.
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
Definition at line 164 of file qgsscalecombobox.cpp.
| 
 | signal | 
Emitted when user has finished editing/selecting a new scale.
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
| QString QgsScaleComboBox::scaleString | ( | ) | const | 
Returns the selected scale as a string, e.g.
"1:150".
Definition at line 121 of file qgsscalecombobox.cpp.
| void QgsScaleComboBox::setAllowNull | ( | bool | allowNull | ) | 
Sets whether the scale combobox can be set to a NULL value.
Definition at line 269 of file qgsscalecombobox.cpp.
| 
 | slot | 
Set the minimum allowed scale.
Set to 0 to disable the minimum scale. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. Any scale lower than the minimum scale will automatically be converted to the minimum scale. Except for 0 which is always allowed.
Definition at line 281 of file qgsscalecombobox.cpp.
| 
 | slot | 
Sets the combo box to the null value.
This only has an effect if allowNull() is true.
Definition at line 290 of file qgsscalecombobox.cpp.
| 
 | slot | 
Set the selected scale from a double.
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
Definition at line 174 of file qgsscalecombobox.cpp.
| bool QgsScaleComboBox::setScaleString | ( | const QString & | string | ) | 
Set the selected scale from a string, e.g.
"1:150".
Definition at line 126 of file qgsscalecombobox.cpp.
| 
 | overrideprotected | 
Definition at line 89 of file qgsscalecombobox.cpp.
| 
 | static | 
Helper function to convert a scale string to double.
The returned value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. If specified, ok will be set to true if the string was successfully interpreted as a scale. 
Definition at line 229 of file qgsscalecombobox.cpp.
| 
 | static | 
Helper function to convert a scale double to scale string.
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
The returned string will be rounded (e.g. 1:1000, not 1:1000.345).
Definition at line 209 of file qgsscalecombobox.cpp.
| 
 | slot | 
Sets the list of predefined scales to show in the combobox.
List elements are expected to be valid scale strings, such as "1:1000000".
Definition at line 40 of file qgsscalecombobox.cpp.
| 
 | readwrite | 
Definition at line 34 of file qgsscalecombobox.h.
| 
 | readwrite | 
Definition at line 33 of file qgsscalecombobox.h.