-- pre-holiday
This commit is contained in:
@@ -134,22 +134,9 @@ XQItemType* XQItemType::replaceAttribute( const QVariant& newValue, int role )
|
||||
}
|
||||
|
||||
|
||||
//! formatiert den content() string eines items.
|
||||
|
||||
QVariant XQItemType::formatText( const XQItem& item ) const
|
||||
{
|
||||
XQItem::UnitType uType = unitType();
|
||||
//qDebug() << " --- formatText: " << XQItem::fetchUnitTypeToString( uType);
|
||||
const QString& cont = item.rawText();
|
||||
if( uType != XQItem::NoUnitType )
|
||||
return formatToSI( cont, uType );
|
||||
return cont;
|
||||
}
|
||||
|
||||
|
||||
//! formatiert einen zahlenwert als string mit einheit.
|
||||
|
||||
QString XQItemType::formatToSI( const QString& valueTxt, XQItem::UnitType unitType ) const
|
||||
QString XQItemType::formatToSI( const QString& valueTxt, XQItem::UnitType unitType )
|
||||
{
|
||||
|
||||
if( valueTxt.isEmpty() )
|
||||
@@ -180,18 +167,18 @@ QString XQItemType::formatToSI( const QString& valueTxt, XQItem::UnitType unitTy
|
||||
strVal = sysLocale.toString(nVal, 'f', 2);
|
||||
strPrefix = s_PrefixExponentMap.key(exp);
|
||||
//qDebug() << " convert: " << dVal << " : " << valueTxt << ": " << strVal << ":" << exp << " : " << strPrefix << ": " << nVal;
|
||||
|
||||
return QString("%1 %2%3").arg( strVal, strPrefix, unitTypeToString() );
|
||||
QString unitStr = XQItem::fetchUnitTypeToString( unitType);
|
||||
return QString("%1 %2%3").arg( strVal, strPrefix, unitStr );
|
||||
|
||||
}
|
||||
|
||||
|
||||
//! entfernt die einheit aus einem formatierten string
|
||||
|
||||
QString XQItemType::unFormatFromSI(const QString& formText ) const
|
||||
QString XQItemType::unFormatFromSI(const QString& formText )
|
||||
{
|
||||
|
||||
QString input = formText.simplified();
|
||||
const QString input = formText.simplified();
|
||||
// #1: strip numeric part
|
||||
if( input.isEmpty() )
|
||||
return input;
|
||||
|
Reference in New Issue
Block a user