Class: QgsRatioLockButton

A cross platform button subclass used to represent a locked / unlocked ratio state.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsRatioLockButton

Base classes

QToolButton

QAbstractButton

QWidget

QObject

QPaintDevice

Methods

locked

Returns whether the button state is locked.

resetRatio

Resets the current width/height ratio, taking the width and height from the current values of the width and height spin boxes.

setHeightSpinBox

Registers a spin box widget as the linked "height" spin box.

setLocked

Sets whether the button state is locked.

setWidthSpinBox

Registers a spin box widget as the linked "width" spin box.

Signals

lockChanged

Emitted whenever the lock state changes.

class qgis.gui.QgsRatioLockButton[source]

Bases: QToolButton

__init__(parent: QWidget | None = None)

Construct a new ratio lock button. Use parent to attach a parent QWidget to the button.

Parameters:

parent (Optional[QWidget] = None)

signal lockChanged(locked: bool)[source]

Emitted whenever the lock state changes.

Parameters:

locked (bool)

locked(self) bool[source]

Returns whether the button state is locked.

Return type:

bool

Returns:

True if the button state is locked.

See also

setLocked()

resetRatio(self)[source]

Resets the current width/height ratio, taking the width and height from the current values of the width and height spin boxes.

setHeightSpinBox(self, widget: QDoubleSpinBox | None)[source]

Registers a spin box widget as the linked “height” spin box.

If both a width and height spin box are linked to the button, they will automatically have their values updates when if the other spin box value is changed. I.e. changing the width spin box will automatically update the height spin box to a value which keeps the same locked ratio.

Parameters:

widget (Optional[QDoubleSpinBox])

setLocked(self, locked: bool)[source]

Sets whether the button state is locked.

Parameters:

locked (bool) – locked state

See also

locked()

setWidthSpinBox(self, widget: QDoubleSpinBox | None)[source]

Registers a spin box widget as the linked “width” spin box.

If both a width and height spin box are linked to the button, they will automatically have their values updates when if the other spin box value is changed. I.e. changing the width spin box will automatically update the height spin box to a value which keeps the same locked ratio.

Parameters:

widget (Optional[QDoubleSpinBox])