LibrePCB Developers Documentation
Loading...
Searching...
No Matches
LengthEditBase Class Referenceabstract

The LengthEditBase class. More...

#include <lengtheditbase.h>

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

Classes

struct  Steps
 

Public Types

enum class  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 setDefaultValueToolTip (const Length &value) 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.
 
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 (const Length &diff) noexcept=0
 

Protected Attributes

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

Detailed Description

The LengthEditBase class.

Member Enumeration Documentation

◆ StepBehavior

enum class 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:

◆ setDefaultValueToolTip()

void setDefaultValueToolTip ( const Length value)
noexcept

◆ setDefaultUnit()

void setDefaultUnit ( const LengthUnit unit)
noexcept
+ 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

◆ 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

◆ 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:

◆ configure()

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

◆ stepBy()

void stepBy ( int  steps)
overridevirtual
+ Here is the call 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

◆ stepEnabled()

QAbstractSpinBox::StepEnabled stepEnabled ( ) const
overrideprotectedvirtual

◆ setValueImpl()

void setValueImpl ( Length  value)
protectednoexcept
+ 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:

◆ 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:

◆ 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 caller graph for this function:

◆ saveSelectedUnit()

void saveSelectedUnit ( )
protectednoexcept

◆ 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 ( const Length diff)
protectedpure virtualnoexcept

Member Data Documentation

◆ mChangeUnitAction

QPointer<QAction> mChangeUnitAction
protected

◆ mDefaultUnit

LengthUnit mDefaultUnit
protected

◆ mSelectedUnit

std::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: