QgsAdvancedDigitizingDockWidget::CadConstraint class

The CadConstraint is an abstract class for all basic constraints (angle/distance/x/y).

It contains all values (locked, value, relative) and pointers to corresponding widgets.

Public types

enum LockMode { NoLock, SoftLock, HardLock }
The lock mode.

Constructors, destructors, conversion operators

CadConstraint(QLineEdit* lineEdit, QToolButton* lockerButton, QToolButton* relativeButton = nullptr, QToolButton* repeatingLockButton = nullptr)
Constructor for CadConstraint.

Public functions

auto isLocked() const -> bool
Is any kind of lock mode enabled.
auto isRepeatingLock() const -> bool
Returns true if a repeating lock is set for the constraint.
auto lineEdit() const -> QLineEdit*
The line edit that manages the value of the constraint.
auto lockMode() const -> LockMode
The current lock mode of this constraint.
auto relative() const -> bool
Is the constraint in relative mode.
void setLockMode(LockMode mode)
Set the lock mode.
void setRelative(bool relative)
Set if the constraint should be treated relative.
void setRepeatingLock(bool repeating)
Sets whether a repeating lock is set for the constraint.
void setValue(double value, bool updateWidget = true)
Set the value of the constraint.
void toggleLocked()
Toggle lock mode.
void toggleRelative()
Toggle relative mode.
auto value() const -> double
The value of the constraint.

Function documentation

QgsAdvancedDigitizingDockWidget::CadConstraint::CadConstraint(QLineEdit* lineEdit, QToolButton* lockerButton, QToolButton* relativeButton = nullptr, QToolButton* repeatingLockButton = nullptr)

Constructor for CadConstraint.

Parameters
lineEdit associated line edit for constraint value
lockerButton associated button for locking constraint
relativeButton optional button for toggling relative constraint mode
repeatingLockButton optional button for toggling repeating lock mode

bool QgsAdvancedDigitizingDockWidget::CadConstraint::isRepeatingLock() const

Returns true if a repeating lock is set for the constraint.

Repeating locks are not automatically cleared after a new point is added.

LockMode QgsAdvancedDigitizingDockWidget::CadConstraint::lockMode() const

The current lock mode of this constraint.

Returns Lock mode

void QgsAdvancedDigitizingDockWidget::CadConstraint::setRepeatingLock(bool repeating)

Sets whether a repeating lock is set for the constraint.

Parameters
repeating set to true to set the lock to repeat automatically

Repeating locks are not automatically cleared after a new point is added.

void QgsAdvancedDigitizingDockWidget::CadConstraint::setValue(double value, bool updateWidget = true)

Set the value of the constraint.

Parameters
value new value for constraint
updateWidget set to false to prevent automatically updating the associated widget's value