Logo Search packages:      
Sourcecode: ktechlab version File versions  Download package

QString Variant::displayString (  )  const

Returns the best possible attempt at representing the data in a string for display. Used by the properties list view.

Definition at line 89 of file variant.cpp.

References Item::getMultiplier(), Item::getNumberMag(), and type().

Referenced by PropertyEditorItem::updateValue().

{
      switch(type())
      {
            case Variant::Type::Double:
            {
                  double numValue = m_value.toDouble();
                  return QString::number( numValue / CNItem::getMultiplier(numValue) ) + " " + CNItem::getNumberMag(numValue) + m_unit;
            }
            
            case Variant::Type::Int:
                  return m_value.toString()+" "+m_unit;
                  
            case Variant::Type::Bool:
                  return m_value.toBool() ? i18n("True") : i18n("False");
                  
            case Variant::Type::Select:
                  return m_allowed[ m_value.toString() ];
                  
            default:
                  return m_value.toString();
      }
}


Generated by  Doxygen 1.6.0   Back to index