]> Git trees. - libqmvoc.git/commitdiff
2 bugs erased, now correct labels and always numbers
authorMartin Pfeiffer <hubipete@gmx.net>
Thu, 14 Jul 2005 21:38:19 +0000 (21:38 +0000)
committerMartin Pfeiffer <hubipete@gmx.net>
Thu, 14 Jul 2005 21:38:19 +0000 (21:38 +0000)
svn path=/trunk/KDE/kdeedu/kalzium/src/spectrum.cpp; revision=434638

kalzium/src/spectrum.cpp

index 3780c4c9f11b81e2d2d3ccc12d295d736438d2b8..6b04dcb1ac0e14326d70ecfc6c51262bdc230779 100644 (file)
@@ -114,7 +114,7 @@ void SpectrumWidget::drawEmmissionSpectrum( QPainter *p )
                        continue;
 
                int x = xPos( *it );
-               
+       
                int temp = 0; // every second item will have a little offset
                if ( i%2 )
                        temp = 35;
@@ -123,6 +123,7 @@ void SpectrumWidget::drawEmmissionSpectrum( QPainter *p )
                
                p->setPen(linecolor( *it ));
                p->drawLine( x,0,x, m_realHeight );
+               //p->drawRect( x,0,x+width()/(endValue-startValue),m_realHeight );
                p->setPen( Qt::black );
                p->drawLine( x,m_realHeight,x, m_realHeight+10+temp );
                p->setPen( Qt::black );
@@ -144,8 +145,8 @@ void SpectrumWidget::drawEmmissionSpectrum( QPainter *p )
 void SpectrumWidget::drawTickmarks( QPainter* p )
 {
        const int space = 13;
-/*     
-       for ( int i = 0; i < width() ; i+=10 )
+       
+/*     for ( int i = 0; i < width() ; i+=10 )
        {
                p->drawLine( i,m_realHeight,i, m_realHeight+5 );
        }
@@ -158,23 +159,23 @@ void SpectrumWidget::drawTickmarks( QPainter* p )
                p->drawLine( i,m_realHeight,i, m_realHeight+10 );
                p->fillRect( i-space, m_realHeight+12, 2*space, 15, Qt::white );
                p->drawText( i-space, m_realHeight+12, 2*space, 15, Qt::AlignCenter, QString::number( wave ) );
-       }*/
-
+       }
+*/
        int start = (int)startValue % 10;
        double dist =  width()/(endValue-startValue) * 10;      //distance between the tickles in px
 
-       int count = startValue + start;
+       int count = startValue - start + 10;
        start *= width()/(endValue-startValue);
 
        for ( int i = start; i < width(); i += dist )
        {
                if(count%50 == 0 )
                {
-                       int wave = ( int )Wavelength( i/width() );
+                       //int wave = ( int )Wavelength( count );
 
                        p->drawLine( i, m_realHeight, i, m_realHeight+10 );     
                        p->fillRect( i-space, m_realHeight+12, 2*space, 15, Qt::white );
-                       p->drawText( i-space, m_realHeight+12, 2*space, 15, Qt::AlignCenter, QString::number( wave ) );         
+                       p->drawText( i-space, m_realHeight+12, 2*space, 15, Qt::AlignCenter, QString::number( count ) );                
                }
                else
                {