[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdeedu/kalzium/src
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2005-10-23 15:34:10
Message-ID: 1130081650.178704.6280.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 473393 by aacid:

round() -> qRound()
BUGS: 114813


 M  +1 -1      kalziumutils.cpp  
 M  +1 -1      spectrum.cpp  
 M  +3 -18     spectrumwidget.cpp  
 M  +0 -2      spectrumwidget.h  


--- branches/KDE/3.5/kdeedu/kalzium/src/kalziumutils.cpp #473392:473393
@@ -63,7 +63,7 @@
 		power *= 10;
 
 	num = num / power * 10000;
-	num = round( num );
+	num = qRound( num );
 
 	return num * power / 10000;
 }
--- branches/KDE/3.5/kdeedu/kalzium/src/spectrum.cpp #473392:473393
@@ -97,7 +97,7 @@
 		double curInt = ( ( double )( *it ).intensity );
 		
 		double newInt = max*1000/curInt;
-		( *it ).intensity = ( int ) round( newInt );
+		( *it ).intensity = qRound( newInt );
 	}
 }
 
--- branches/KDE/3.5/kdeedu/kalzium/src/spectrumwidget.cpp #473392:473393
@@ -21,6 +21,7 @@
 #include "spectrumwidget.h"
 #include "spectrum.h"
 #include "element.h"
+#include "kalziumutils.h"
 
 #include <kdebug.h>
 #include <klocale.h>
@@ -216,7 +217,7 @@
 	if ( color == 0.0 )
 		return 0;
 	else
-		return ( int )( round( IntensityMax * pow( color*factor, Gamma ) ) );
+		return qRound( IntensityMax * pow( color*factor, Gamma ) );
 }
 
 void SpectrumWidget::drawTickmarks( QPainter* p )
@@ -243,7 +244,7 @@
 			{
 				pos = ( double ) ( i*d )/width();
 				p->fillRect( i*d-space, m_realHeight+12, 2*space, 15, Qt::white );
-				p->drawText( i*d-space, m_realHeight+12, 2*space, 15, Qt::AlignCenter, \
QString::number( strippedValue( Wavelength( pos ) ) ) ); +				p->drawText( i*d-space, \
m_realHeight+12, 2*space, 15, Qt::AlignCenter, QString::number( \
KalziumUtils::strippedValue( Wavelength( pos ) ) ) );  }
 		}
 		else {//small tickmarks
@@ -252,22 +253,6 @@
 	}
 }
 
-double SpectrumWidget::strippedValue( double num )
-{
-	if ( !finite( num ) )
-		return num;
-
-	double power;
-	power = 1e-6;
-	while ( power < num )
-		power *= 10;
-
-	num = num / power * 10000;
-	num = round( num );
-
-	return num * power / 10000;
-}
-
 void SpectrumWidget::keyPressEvent( QKeyEvent *e )
 {
 	 kdDebug() << "SpectrumWidget::keyPressEvent()" << endl;
--- branches/KDE/3.5/kdeedu/kalzium/src/spectrumwidget.h #473392:473393
@@ -141,8 +141,6 @@
 			return startValue + (  (  endValue-startValue ) *  xpos );
 		}
 
-		double strippedValue( double num );
-
 		/**
 		 * This method changes the three values @p r, @p g and @p b to the
 		 * correct values


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic