Class: QgsScaleRangeWidget

A widget allowing entry of a range of map scales, e.g. minimum scale and maximum scale.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsScaleRangeWidget

Base classes

QWidget

QObject

QPaintDevice

Methods

maximumScale

Returns the selected maximum scale (i.e. most "zoomed in" scale), or 0 if maximum scale is not set.

minimumScale

Returns the selected minimum scale (i.e. most "zoomed out" scale), or 0 if minimum scale is not set.

reloadProjectScales

Call to reload the preset scales from the current project and apply them to the 2 scales combo boxes.

setMapCanvas

Sets the map canvas which will be used for the current scale buttons.

setMaximumScale

Set the maximum scale (i.e. most "zoomed in" scale), or 0 to indicate the minimum is not set.

setMinimumScale

Set the minimum scale (i.e. most "zoomed out" scale), or 0 to indicate the minimum is not set.

setScaleRange

Sets the scale range, from min scale (i.e. most "zoomed out" scale) to max scale (most "zoomed in" scale).

Signals

rangeChanged

Emitted when the scale range set in the widget is changed.

class qgis.gui.QgsScaleRangeWidget[source]

Bases: QWidget

__init__(parent: QWidget | None = None)

Constructor for QgsScaleRangeWidget.

Parameters:

parent (Optional[QWidget] = None)

maximumScale(self) float[source]

Returns the selected maximum scale (i.e. most “zoomed in” scale), or 0 if maximum scale is not set. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.

See also

minimumScale()

Return type:

float

minimumScale(self) float[source]

Returns the selected minimum scale (i.e. most “zoomed out” scale), or 0 if minimum scale is not set. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.

See also

maximumScale()

Return type:

float

signal rangeChanged(min: float, max: float)[source]

Emitted when the scale range set in the widget is changed. The scale values indicates the scale denominator, e.g. 1000.0 for a 1:1000 map, or 0 to indicate not set.

Parameters:
  • min (float)

  • max (float)

reloadProjectScales(self)[source]

Call to reload the preset scales from the current project and apply them to the 2 scales combo boxes.

setMapCanvas(self, canvas: QgsMapCanvas | None)[source]

Sets the map canvas which will be used for the current scale buttons. If not set, the buttons are hidden.

Parameters:

canvas (Optional[QgsMapCanvas])

setMaximumScale(self, scale: float)[source]

Set the maximum scale (i.e. most “zoomed in” scale), or 0 to indicate the minimum is not set. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.

See also

maximumScale()

See also

setScaleRange()

Warning

Calling setMinimumScale() places a restriction on the acceptable maximum scale for the widget, and will alter any previously set maximum scale to pass this constraint. Always call setMinimumScale() before setMaximumScale() when restoring a scale range in the widget, or use the convenience method setScaleRange() instead.

Parameters:

scale (float)

setMinimumScale(self, scale: float)[source]

Set the minimum scale (i.e. most “zoomed out” scale), or 0 to indicate the minimum is not set. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.

See also

minimumScale()

See also

setScaleRange()

Warning

Calling setMinimumScale() places a restriction on the acceptable maximum scale for the widget, and will alter any previously set maximum scale to pass this constraint. Always call setMinimumScale() before setMaximumScale() when restoring a scale range in the widget, or use the convenience method setScaleRange() instead.

Parameters:

scale (float)

setScaleRange(self, min: float, max: float)[source]

Sets the scale range, from min scale (i.e. most “zoomed out” scale) to max scale (most “zoomed in” scale). The scale values indicates the scale denominator, e.g. 1000.0 for a 1:1000 map, or 0 to indicate not set.

Parameters:
  • min (float)

  • max (float)