Class: QgsMapUnitScaleWidget

A widget which allows the user to choose the minimum and maximum scale of an object in map units and millimeters.

This widget is designed to allow users to edit the properties of a QgsMapUnitScale object.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsMapUnitScaleWidget

Base classes

QgsPanelWidget

Base class for any widget that can be shown as an inline panel.

QWidget

QObject

QPaintDevice

Methods

mapUnitScale

Returns a QgsMapUnitScale representing the settings shown in the widget.

setMapCanvas

Sets the map canvas associated with the widget.

setMapUnitScale

Updates the widget to reflect the settings from the specified QgsMapUnitScale object.

Signals

mapUnitScaleChanged

Emitted when the settings in the widget are modified.

class qgis.gui.QgsMapUnitScaleWidget[source]

Bases: QgsPanelWidget

__init__(parent: QWidget | None = None)

Constructor for QgsMapUnitScaleWidget.

Parameters:

parent (Optional[QWidget] = None) – parent widget

mapUnitScale(self) QgsMapUnitScale[source]

Returns a QgsMapUnitScale representing the settings shown in the widget.

Return type:

QgsMapUnitScale

signal mapUnitScaleChanged(scale: QgsMapUnitScale)[source]

Emitted when the settings in the widget are modified.

Parameters:

scale (QgsMapUnitScale) – QgsMapUnitScale reflecting new settings from the widget

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

Sets the map canvas associated with the widget. This allows the widget to retrieve the current map scale from the canvas.

Parameters:

canvas (Optional[QgsMapCanvas]) – map canvas

setMapUnitScale(self, scale: QgsMapUnitScale)[source]

Updates the widget to reflect the settings from the specified QgsMapUnitScale object.

Parameters:

scale (QgsMapUnitScale) – map unit scale to show in widget

See also

mapUnitScale()