LibrePCB Developers Documentation
LengthEditBase Class Referenceabstract

The LengthEditBase class. More...

#include <lengtheditbase.h>

+ Inheritance diagram for LengthEditBase:
+ Collaboration diagram for LengthEditBase:

Classes

struct  Steps
 

Public Types

enum  StepBehavior
 

Signals

void displayedUnitChanged (const LengthUnit &unit)
 

Public Member Functions

 LengthEditBase ()=delete
 
 LengthEditBase (const Length &min, const Length &max, const Length &value, QWidget *parent=nullptr) noexcept
 
 LengthEditBase (const LengthEditBase &other)=delete
 
virtual ~LengthEditBase () noexcept
 
const LengthUnitgetDisplayedUnit () const noexcept
 
void setDefaultUnit (const LengthUnit &unit) noexcept
 
void setChangeUnitActionVisible (bool visible) noexcept
 
void setStepBehavior (StepBehavior behavior) noexcept
 
void setSteps (const QVector< PositiveLength > &steps) noexcept
 Set the supported up/down step values. More...
 
void resetUnit () noexcept
 
void configureClientSettings (const QString &uniqueIdentifier) noexcept
 
void configure (const LengthUnit &defaultUnit, const QVector< PositiveLength > &steps, const QString &uniqueIdentifier) noexcept
 
virtual void stepBy (int steps) override
 
QSize minimumSizeHint () const override
 
QSize sizeHint () const override
 
LengthEditBaseoperator= (const LengthEditBase &rhs)=delete
 

Protected Member Functions

virtual QAbstractSpinBox::StepEnabled stepEnabled () const override
 
void setValueImpl (Length value) noexcept
 
void updateValueFromText (QString text) noexcept
 
void updateSingleStep () noexcept
 
void updateSingleStepPredefined () noexcept
 
void updateSingleStepHalfDouble () noexcept
 
void updateText () noexcept
 
LengthUnit extractUnitFromExpression (QString &expression) const noexcept
 
void changeUnitActionTriggered () noexcept
 
void setSelectedUnit (const LengthUnit &unit) noexcept
 
void saveSelectedUnit () noexcept
 
QString getValueStr (const LengthUnit &unit) const noexcept
 
virtual void valueChangedImpl () noexcept=0
 

Protected Attributes

QAction * mChangeUnitAction
 
LengthUnit mDefaultUnit
 
tl::optional< LengthUnitmSelectedUnit
 
Length mMinimum
 
Length mMaximum
 
Length mValue
 
StepBehavior mStepBehavior
 
QVector< PositiveLengthmSteps
 
Length mSingleStepUp
 Zero means "no step available". More...
 
Length mSingleStepDown
 Zero means "no step available". More...
 
QSize mAdditionalSize
 
QString mSettingsKey
 Empty means "do not save". More...
 

Detailed Description

The LengthEditBase class.

Member Enumeration Documentation

◆ StepBehavior

enum StepBehavior
strong
Enumerator
PredefinedSteps 
HalfAndDouble 

Constructor & Destructor Documentation

◆ LengthEditBase() [1/3]

LengthEditBase ( )
delete

◆ LengthEditBase() [2/3]

LengthEditBase ( const Length min,
const Length max,
const Length value,
QWidget *  parent = nullptr 
)
explicitnoexcept
+ Here is the call graph for this function:

◆ LengthEditBase() [3/3]

LengthEditBase ( const LengthEditBase other)
delete

◆ ~LengthEditBase()

~LengthEditBase ( )
virtualnoexcept

Member Function Documentation

◆ getDisplayedUnit()

const LengthUnit & getDisplayedUnit ( ) const
noexcept
+ Here is the caller graph for this function:

◆ setDefaultUnit()

void setDefaultUnit ( const LengthUnit unit)
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setChangeUnitActionVisible()

void setChangeUnitActionVisible ( bool  visible)
noexcept
+ Here is the caller graph for this function:

◆ setStepBehavior()

void setStepBehavior ( StepBehavior  behavior)
noexcept
+ Here is the call graph for this function:

◆ setSteps()

void setSteps ( const QVector< PositiveLength > &  steps)
noexcept

Set the supported up/down step values.

The step with lowest priority (typically the smallest value) must be the first element in the list, the step with highest priority (typically the largest value) the last one.

Example: {0.1mm, 1.0mm} leads to the steps 0.0mm, 0.1mm, .. 0.9mm, 1.0mm, 2.0mm, ...

Parameters
stepsList of supported step values
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetUnit()

void resetUnit ( )
noexcept
+ Here is the call graph for this function:

◆ configureClientSettings()

void configureClientSettings ( const QString &  uniqueIdentifier)
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ configure()

void configure ( const LengthUnit defaultUnit,
const QVector< PositiveLength > &  steps,
const QString &  uniqueIdentifier 
)
noexcept
+ Here is the call graph for this function:

◆ stepBy()

void stepBy ( int  steps)
overridevirtual
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ minimumSizeHint()

QSize minimumSizeHint ( ) const
override

◆ sizeHint()

QSize sizeHint ( ) const
override

◆ operator=()

LengthEditBase& operator= ( const LengthEditBase rhs)
delete

◆ displayedUnitChanged

void displayedUnitChanged ( const LengthUnit unit)
signal
+ Here is the caller graph for this function:

◆ stepEnabled()

QAbstractSpinBox::StepEnabled stepEnabled ( ) const
overrideprotectedvirtual

◆ setValueImpl()

void setValueImpl ( Length  value)
protectednoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateValueFromText()

void updateValueFromText ( QString  text)
protectednoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateSingleStep()

void updateSingleStep ( )
protectednoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateSingleStepPredefined()

void updateSingleStepPredefined ( )
protectednoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateSingleStepHalfDouble()

void updateSingleStepHalfDouble ( )
protectednoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateText()

void updateText ( )
protectednoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extractUnitFromExpression()

LengthUnit extractUnitFromExpression ( QString &  expression) const
protectednoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ changeUnitActionTriggered()

void changeUnitActionTriggered ( )
protectednoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSelectedUnit()

void setSelectedUnit ( const LengthUnit unit)
protectednoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveSelectedUnit()

void saveSelectedUnit ( )
protectednoexcept
+ Here is the caller graph for this function:

◆ getValueStr()

QString getValueStr ( const LengthUnit unit) const
protectednoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ valueChangedImpl()

virtual void valueChangedImpl ( )
protectedpure virtualnoexcept

Implemented in LengthEdit, PositiveLengthEdit, and UnsignedLengthEdit.

+ Here is the caller graph for this function:

Member Data Documentation

◆ mChangeUnitAction

QAction* mChangeUnitAction
protected

◆ mDefaultUnit

LengthUnit mDefaultUnit
protected

◆ mSelectedUnit

tl::optional<LengthUnit> mSelectedUnit
protected

◆ mMinimum

Length mMinimum
protected

◆ mMaximum

Length mMaximum
protected

◆ mValue

Length mValue
protected

◆ mStepBehavior

StepBehavior mStepBehavior
protected

◆ mSteps

QVector<PositiveLength> mSteps
protected

◆ mSingleStepUp

Length mSingleStepUp
protected

Zero means "no step available".

◆ mSingleStepDown

Length mSingleStepDown
protected

Zero means "no step available".

◆ mAdditionalSize

QSize mAdditionalSize
protected

◆ mSettingsKey

QString mSettingsKey
protected

Empty means "do not save".


The documentation for this class was generated from the following files: