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(); }
QVariant CriticalPathItemModel::variance( int role ) const { switch ( role ) { case Qt::DisplayRole: case Qt::ToolTipRole: { double v = 0.0; foreach ( Node *n, m_path ) { long id = m_manager->scheduleId(); v += n->variance( id, presentationUnit( m_project->duration( id ) ) ); } return QLocale().toString( v, 'f', 1 ); break; } case Qt::EditRole: { double v = 0.0; foreach ( Node *n, m_path ) { v += n->variance( m_manager->scheduleId() ); } return v; }
QVariant CriticalPathItemModel::variance( int role ) const { switch ( role ) { case Qt::DisplayRole: case Qt::ToolTipRole: { double v = 0.0; foreach ( Node *n, m_path ) { long id = m_manager->id(); v += n->variance( id, presentationUnit( m_project->duration( id ) ) ); } return KGlobal::locale()->formatNumber( v, 1 ); break; } case Qt::EditRole: { double v = 0.0; foreach ( Node *n, m_path ) { v += n->variance( m_manager->id() ); } return v; }