JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
Loading...
Searching...
No Matches

encodes a number with its unit, e.g. 100% or 45deg or ... More...

#include <jkqtpcsstools.h>

Public Member Functions

 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
 

Public Attributes

double number
 the number value ittself
 
QString unit
 

Detailed Description

encodes a number with its unit, e.g. 100% or 45deg or ...

Constructor & Destructor Documentation

◆ NumberWithUnit()

JKQTPCSSParser::NumberWithUnit::NumberWithUnit ( double  val = 0.0,
const QString &  unit_ = QString() 
)
inline

Member Function Documentation

◆ 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

Member Data Documentation

◆ number

double JKQTPCSSParser::NumberWithUnit::number

the number value ittself

◆ unit

QString JKQTPCSSParser::NumberWithUnit::unit

\bref unit as string


The documentation for this struct was generated from the following file: