20#ifndef LIBREPCB_CORE_LENGTHUNIT_H
21#define LIBREPCB_CORE_LENGTHUNIT_H
130 QString
toStr() const noexcept;
161 QString
format(const
Length& value, const QLocale& locale,
162 const QString& separator = " ") const noexcept;
316 return mUnit == rhs.mUnit;
319 return mUnit != rhs.mUnit;
346 stream << unit.
toStr();
351 stream << QString(
"LengthUnit(%1)").arg(unit.
toStr());
The Length class is used to represent a length (for example 12.75 millimeters)
Definition length.h:82
The LengthUnit class represents a length unit (millimeters, inches,...) and provides some useful meth...
Definition lengthunit.h:60
QString toStringTr() const noexcept
Convert the length unit to a localized string.
Definition lengthunit.cpp:63
QString format(const Length &value, const QLocale &locale, const QString &separator=" ") const noexcept
Get a pretty formatted length value with this unit.
Definition lengthunit.cpp:103
LengthUnit_t mUnit
Holds the length unit of the object.
Definition lengthunit.h:338
QString toStr() const noexcept
Serialize this object into a string.
Definition lengthunit.cpp:43
int getIndex() const noexcept
Get the Index of the length unit of this object.
Definition lengthunit.h:123
QString toShortStringTr() const noexcept
Convert the length unit to a localized string (short form)
Definition lengthunit.cpp:83
LengthUnit(LengthUnit_t unit) noexcept
Private Constructor to create a LengthUnit object with a specific unit.
Definition lengthunit.h:331
qreal convertToUnit(const Length &length) const noexcept
Convert a Length to this length unit.
Definition lengthunit.cpp:152
bool operator==(const LengthUnit &rhs) const noexcept
Definition lengthunit.h:315
static LengthUnit fromString(const QString &str)
Get the length unit represented by a string.
Definition lengthunit.cpp:234
static LengthUnit nanometers() noexcept
Definition lengthunit.h:302
static LengthUnit micrometers() noexcept
Definition lengthunit.h:299
static QList< LengthUnit > getAllUnits() noexcept
Get all available length units.
Definition lengthunit.cpp:252
static LengthUnit fromIndex(int index)
Get the length unit of a specific index (to use with getIndex())
Definition lengthunit.cpp:245
static LengthUnit mils() noexcept
Definition lengthunit.h:308
LengthUnit_t
An enum which contains all available length units.
Definition lengthunit.h:77
@ _COUNT
count of units, must be the last entry of the enum
LengthUnit & operator=(const LengthUnit &rhs) noexcept
Definition lengthunit.h:311
static LengthUnit millimeters() noexcept
Definition lengthunit.h:296
Length convertFromUnit(qreal length) const
Convert a floating point number with this unit to a Length object.
Definition lengthunit.cpp:192
bool operator!=(const LengthUnit &rhs) const noexcept
Definition lengthunit.h:318
LengthUnit(const LengthUnit &other) noexcept
Copy constructor.
Definition lengthunit.h:99
LengthUnit() noexcept
Default constructor which uses millimeters as unit.
Definition lengthunit.h:92
int getReasonableNumberOfDecimals() const noexcept
Get a reasonable number of decimals to be shown.
Definition lengthunit.cpp:110
~LengthUnit() noexcept
Destructor.
Definition lengthunit.h:104
static LengthUnit inches() noexcept
Definition lengthunit.h:305
QStringList getUserInputSuffixes() const noexcept
Get user input suffixes.
Definition lengthunit.cpp:131
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
Definition occmodel.cpp:76
QDataStream & operator<<(QDataStream &stream, const AttributeKey &obj)
Definition attributekey.h:108