Class: QgsScaleComboBox¶
A combobox which lets the user select map scale from predefined list and highlights nearest to current scale value.
List of all members, including inherited members
Class Hierarchy¶
Base classes¶
Methods
Returns |
|
Returns |
|
Returns the minimum scale, or 0 if no minimum scale set. |
|
Returns the selected scale as a double. |
|
Returns the selected scale as a string, e.g. "1:150". |
|
Sets whether the scale combobox can be set to a NULL value. |
|
Set the minimum allowed scale. |
|
Sets the combo box to the null value. |
|
Sets the list of predefined scales to show in the combobox. |
|
Set the selected scale from a double. |
|
Set the selected scale from a string, e.g. "1:150". |
|
Sets the list of predefined scales to show in the combobox. |
Static Methods
Helper function to convert a scale string to double. |
|
Helper function to convert a scale double to scale string. |
Signals
Emitted when user has finished editing/selecting a new scale. |
- class qgis.gui.QgsScaleComboBox[source]¶
Bases:
QComboBox- __init__(parent: QWidget | None = None)
Constructor for QgsScaleComboBox.
- Parameters:
parent (Optional[QWidget] = None)
- allowNull(self) bool[source]¶
Returns
Trueif the combobox can be set to a NULL value.See also
See also
See also
Added in version 3.8.
- Return type:
bool
- isNull(self) bool[source]¶
Returns
Trueif the combo box is currently set to a “null” value.See also
See also
Added in version 3.8.
- Return type:
bool
- minScale(self) float[source]¶
Returns the minimum scale, or 0 if no minimum scale set. The
scalevalue 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.- Return type:
float
- scale(self) float[source]¶
Returns the selected scale as a double. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
See also
- Return type:
float
- signal scaleChanged(scale: float)[source]¶
Emitted when user has finished editing/selecting a new scale. The
scalevalue indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.- Parameters:
scale (float)
- scaleString(self) str[source]¶
Returns the selected scale as a string, e.g. “1:150”.
See also
- Return type:
str
- setAllowNull(self, allowNull: bool)[source]¶
Sets whether the scale combobox can be set to a NULL value.
See also
See also
See also
Added in version 3.8.
- Parameters:
allowNull (bool)
- setMinScale(self, scale: float)[source]¶
Set the minimum allowed
scale. Set to 0 to disable the minimum scale. Thescalevalue 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.- Parameters:
scale (float)
- setNull(self)[source]¶
Sets the combo box to the null value.
This only has an effect if
allowNull()isTrue.See also
See also
Added in version 3.8.
- setPredefinedScales(self, scales: Iterable[float])[source]¶
Sets the list of predefined
scalesto show in the combobox. List elements are expected to be scale denominators, e.g. 1000.0 for a 1:1000 map.If
scalesis empty then the default user scale options will be used instead.Added in version 3.38.
- Parameters:
scales (Iterable[float])
- setScale(self, scale: float)[source]¶
Set the selected scale from a double. The
scalevalue indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.See also
- Parameters:
scale (float)
- setScaleString(self, string: str | None) bool[source]¶
Set the selected scale from a
string, e.g. “1:150”.See also
- Parameters:
string (Optional[str])
- Return type:
bool
- static toDouble(string: str | None)[source]¶
Helper function to convert a scale
stringto double. The returned value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. If specified,okwill be set toTrueif the string was successfully interpreted as a scale.See also
- Parameters:
string (Optional[str])
- Return type:
(float, Optional[bool])