QgsRatioLockButton class

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

Constructors, destructors, conversion operators

QgsRatioLockButton(QWidget* parent = nullptr)
Construct a new ratio lock button.

Public functions

auto locked() const -> bool
Returns whether the button state is locked.
void resetRatio()
Resets the current width/height ratio, taking the width and height from the current values of the width and height spin boxes.
void setHeightSpinBox(QDoubleSpinBox* widget)
Registers a spin box widget as the linked "height" spin box.
void setLocked(bool locked)
Sets whether the button state is locked.
void setWidthSpinBox(QDoubleSpinBox* widget)
Registers a spin box widget as the linked "width" spin box.

Signals

void lockChanged(bool locked)
Emitted whenever the lock state changes.

Function documentation

QgsRatioLockButton::QgsRatioLockButton(QWidget* parent = nullptr)

Construct a new ratio lock button.

Use parent to attach a parent QWidget to the button.

bool QgsRatioLockButton::locked() const

Returns whether the button state is locked.

Returns true if the button state is locked.

void QgsRatioLockButton::setHeightSpinBox(QDoubleSpinBox* widget)

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.

void QgsRatioLockButton::setLocked(bool locked)

Sets whether the button state is locked.

Parameters
locked locked state

void QgsRatioLockButton::setWidthSpinBox(QDoubleSpinBox* widget)

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.