QgsMapUnitScaleWidget class

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.

Base classes

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

Constructors, destructors, conversion operators

QgsMapUnitScaleWidget(QWidget* parent = nullptr)
Constructor for QgsMapUnitScaleWidget.

Public functions

auto mapUnitScale() const -> QgsMapUnitScale
Returns a QgsMapUnitScale representing the settings shown in the widget.
void setMapCanvas(QgsMapCanvas* canvas)
Sets the map canvas associated with the widget.
void setMapUnitScale(const QgsMapUnitScale& scale)
Updates the widget to reflect the settings from the specified QgsMapUnitScale object.

Signals

void mapUnitScaleChanged(const QgsMapUnitScale& scale)
Emitted when the settings in the widget are modified.

Function documentation

QgsMapUnitScaleWidget::QgsMapUnitScaleWidget(QWidget* parent = nullptr)

Constructor for QgsMapUnitScaleWidget.

Parameters
parent parent widget

QgsMapUnitScale QgsMapUnitScaleWidget::mapUnitScale() const

Returns a QgsMapUnitScale representing the settings shown in the widget.

void QgsMapUnitScaleWidget::setMapCanvas(QgsMapCanvas* canvas)

Sets the map canvas associated with the widget.

Parameters
canvas map canvas

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

void QgsMapUnitScaleWidget::setMapUnitScale(const QgsMapUnitScale& scale)

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

Parameters
scale map unit scale to show in widget

void QgsMapUnitScaleWidget::mapUnitScaleChanged(const QgsMapUnitScale& scale) signal

Emitted when the settings in the widget are modified.

Parameters
scale QgsMapUnitScale reflecting new settings from the widget