23 QList< QgsUnitTypes::LayoutUnit > units;
33 const auto constUnits = units;
39 connect(
this,
static_cast<void (
QgsLayoutUnitsComboBox::* )(
int )
>( &QgsLayoutUnitsComboBox::currentIndexChanged ),
this, &QgsLayoutUnitsComboBox::indexChanged );
49 setCurrentIndex( findData(
unit ) );
54 mLinkedSpinBoxes << widget;
57void QgsLayoutUnitsComboBox::indexChanged(
int )
62 const auto constMLinkedSpinBoxes = mLinkedSpinBoxes;
63 for (
const QPointer< QDoubleSpinBox > &widget : constMLinkedSpinBoxes )
This class provides a method of converting QgsLayoutMeasurements from one unit to another.
QgsLayoutMeasurement convert(QgsLayoutMeasurement measurement, QgsUnitTypes::LayoutUnit targetUnits) const
Converts a measurement from one unit to another.
This class provides a method of storing measurements for use in QGIS layouts using a variety of diffe...
double length() const
Returns the length of the measurement.
A custom combo box for selecting units for layout settings.
void linkToWidget(QDoubleSpinBox *widget)
Registers a spin box widget as linked with the combo box.
QgsLayoutMeasurementConverter * converter() const
Returns the converter used when automatically converting units for linked widgets.
void changed(QgsUnitTypes::LayoutUnit unit)
Emitted when the unit is changed.
void setConverter(QgsLayoutMeasurementConverter *converter)
Sets a converter to use when automatically converting units for linked widgets.
QgsUnitTypes::LayoutUnit unit
void setUnit(QgsUnitTypes::LayoutUnit unit)
Sets the unit currently selected in the combo box.
QgsLayoutUnitsComboBox(QWidget *parent=nullptr)
Constructor for QgsLayoutUnitsComboBox.
LayoutUnit
Layout measurement units.
@ LayoutMillimeters
Millimeters.
@ LayoutCentimeters
Centimeters.
@ LayoutPicas
Typographic picas.
@ LayoutPoints
Typographic points.
static Q_INVOKABLE QString toString(QgsUnitTypes::DistanceUnit unit)
Returns a translated string representing a distance unit.
static Q_INVOKABLE QString toAbbreviatedString(QgsUnitTypes::DistanceUnit unit)
Returns a translated abbreviation representing a distance unit.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.