Duration::Unit CriticalPathItemModel::presentationUnit( const Duration &dur ) const { if ( dur.toDouble( Duration::Unit_d ) < 1.0 ) { return Duration::Unit_h; } return Duration::Unit_d; }
QVariant CriticalPathItemModel::duration( int role ) const { switch ( role ) { case Qt::DisplayRole: case Qt::ToolTipRole: { Duration v = m_project->duration( m_manager->scheduleId() ); return QVariant(QLocale().toString( v.toDouble( presentationUnit( v ) ), 'f', 1 ) + Duration::unitToString( presentationUnit( v ) )); } case Qt::StatusTipRole: case Qt::WhatsThisRole: return QVariant(); } return QVariant(); }
QVariant CriticalPathItemModel::duration( int role ) const { switch ( role ) { case Qt::DisplayRole: case Qt::ToolTipRole: { Duration v = m_project->duration( m_manager->id() ); return KGlobal::locale()->formatNumber( v.toDouble( presentationUnit( v ) ), 1 ) + Duration::unitToString( presentationUnit( v ) ); } case Qt::StatusTipRole: case Qt::WhatsThisRole: return QVariant(); } return QVariant(); }