encodes a number with its unit, e.g. 100%
or 45deg
or ...
More...
#include <jkqtpcsstools.h>
|
| NumberWithUnit (double val=0.0, const QString &unit_=QString()) |
|
double | normHueNumber () const |
| returns number as a normalized number for Hue, output is in the range 0..1
|
|
double | normNumber () const |
| partly evaluates the unit and transforms the number accordingly.
|
|
double | normRGBNumber () const |
| returns number as a normalized number for RGB, output is in the range 0..1
|
|
QString | normUnit () const |
| returns a normalized version of the unit, i.e. all lower-case, timmed and simplified
|
|
bool | operator== (const NumberWithUnit &other) const |
|
|
double | number |
| the number value ittself
|
|
QString | unit |
|
encodes a number with its unit, e.g. 100%
or 45deg
or ...
◆ NumberWithUnit()
JKQTPCSSParser::NumberWithUnit::NumberWithUnit |
( |
double |
val = 0.0 , |
|
|
const QString & |
unit_ = QString() |
|
) |
| |
|
inline |
◆ normHueNumber()
double JKQTPCSSParser::NumberWithUnit::normHueNumber |
( |
| ) |
const |
|
inline |
returns number as a normalized number for Hue, output is in the range 0..1
This interprets %-values and all other values as from the range 0..360 and noralizes both to 0..1
◆ normNumber()
double JKQTPCSSParser::NumberWithUnit::normNumber |
( |
| ) |
const |
|
inline |
partly evaluates the unit and transforms the number accordingly.
This will do these transformations:
- unit ==
%
--> returns number/100.0;
- unit == angle unit : returns number in degrees:
- unit ==
rad
--> returns number/M_PI*180.0
- unit ==
turn
--> returns number*360.0
- unit ==
grad
--> returns number/400.0*360.0
◆ normRGBNumber()
double JKQTPCSSParser::NumberWithUnit::normRGBNumber |
( |
| ) |
const |
|
inline |
returns number as a normalized number for RGB, output is in the range 0..1
This interprets %-values and all other values as from the range 0..255 and noralizes both to 0..1
◆ normUnit()
QString JKQTPCSSParser::NumberWithUnit::normUnit |
( |
| ) |
const |
|
inline |
returns a normalized version of the unit, i.e. all lower-case, timmed and simplified
◆ operator==()
bool JKQTPCSSParser::NumberWithUnit::operator== |
( |
const NumberWithUnit & |
other | ) |
const |
|
inline |
◆ number
double JKQTPCSSParser::NumberWithUnit::number |
◆ unit
QString JKQTPCSSParser::NumberWithUnit::unit |
The documentation for this struct was generated from the following file: