Class: QgsLayoutUnitsComboBox¶
A custom combo box for selecting units for layout settings.

QgsLayoutUnitsComboBox in the collapsed state¶

QgsLayoutUnitsComboBox in the expanded state¶
Class Hierarchy¶
Base classes¶
Methods
Returns the converter used when automatically converting units for linked widgets. |
|
Registers a spin box widget as linked with the combo box. |
|
Sets a converter to use when automatically converting units for linked widgets. |
|
Sets the unit currently selected in the combo box. |
|
Returns the unit currently selected in the combo box. |
Signals
Emitted when the unit is changed. |
- class qgis.gui.QgsLayoutUnitsComboBox[source]¶
Bases:
QComboBox
- __init__(parent: QWidget | None = None)
Constructor for QgsLayoutUnitsComboBox.
- Parameters:
parent (Optional[QWidget] = None)
- converter(self) QgsLayoutMeasurementConverter | None [source]¶
Returns the converter used when automatically converting units for linked widgets.
See also
- Return type:
Optional[QgsLayoutMeasurementConverter]
- linkToWidget(self, widget: QDoubleSpinBox | None)[source]¶
Registers a spin box
widget
as linked with the combo box.Registered spin boxes will automatically be upodated whenever the unit is changed. I.e. a spin box with a value of 100 will be set to 1 when the unit is changed from centimeters to meters.
A measurement
converter()
must be set in order for the automatic unit conversion to occur.See also
- Parameters:
widget (Optional[QDoubleSpinBox])
- setConverter(self, converter: QgsLayoutMeasurementConverter | None)[source]¶
Sets a
converter
to use when automatically converting units for linked widgets. The ownership ofconverter
is not transferred, and converter must exist for the life of the combo box.See also
- Parameters:
converter (Optional[QgsLayoutMeasurementConverter])
- setUnit(self, unit: Qgis.LayoutUnit)[source]¶
Sets the
unit
currently selected in the combo box.See also
- Parameters:
unit (Qgis.LayoutUnit)
- unit(self) Qgis.LayoutUnit [source]¶
Returns the unit currently selected in the combo box.
See also
- Return type: