Changeset 10683


Ignore:
Timestamp:
May 24, 2010, 4:17:49 AM (12 years ago)
Author:
Longinus00
Message:

(qt) Don't round ratio

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/utils.cc

    r10682 r10683  
    7878    else if( (int)ratio == TR_RATIO_INF )
    7979        buf = QString::fromUtf8( "\xE2\x88\x9E" );
    80     else if( ratio < 10.0 )
    81         buf.sprintf( "%'.2f", ratio );
    82     else if( ratio < 100.0 )
    83         buf.sprintf( "%'.1f", ratio );
    8480    else
    85         buf.sprintf( "%'.0f", ratio );
     81    {
     82        QStringList temp;
     83
     84        temp = QString().sprintf( "%f", ratio ).split( "." );
     85        if( ratio < 100.0 )
     86        {
     87            if( ratio < 10.0 )
     88                temp[1].truncate( 2 );
     89            else
     90                temp[1].truncate( 1 );
     91            buf = temp.join( "." );
     92        }
     93        else
     94            buf = QString( temp[0] );
     95    }
    8696
    8797    return buf;
Note: See TracChangeset for help on using the changeset viewer.