[Kalzium] [Bug 134086] Spectrum should reset to full width when selecting another element

cniehaus at gmx.de cniehaus at gmx.de
Mon Sep 25 10:16:11 CEST 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=134086         




------- Additional Comments From cniehaus gmx de  2006-09-25 10:10 -------
SVN commit 588165 by cniehaus:

Ok, this is the elegant fix of this bug. Eckard, if you have the motivation
 to backport his better version to 3.5 that is fine, if not that is also
 fine.

While I was doing this  fix, I noticed to methods in the .h which where
 neither used nor implemented ;-) Eckard, perhaps you could remove those in
 3.5?

BUGS:134086


 M  +0 -5      detailinfodlg.cpp
 M  +7 -0      spectrumwidget.cpp
 M  +4 -8      spectrumwidget.h


--- trunk/KDE/kdeedu/kalzium/src/detailinfodlg.cpp #588164:588165
 @ -524,12 +524,7  @
 	// updating spectrum widget
 	if ( m_element->spectrum() )
   {
-      delete m_spectrumview;
-
-      m_spectrumview = new SpectrumViewImpl( m_spectrumStack );
       m_spectrumview->setSpectrum( m_element->spectrum() );
-	m_spectrumStack->addWidget( m_spectrumview );
-      m_spectrumStack->setCurrentWidget( m_spectrumview );
   }
   else
   {
--- trunk/KDE/kdeedu/kalzium/src/spectrumwidget.cpp #588164:588165
 @ -410,5 +410,12  @
 	m_LMBPointCurrent.setX( -1 );
 }

+void SpectrumWidget::restart()
+{
+    //set the minimum and maximum peak to the min/max wavelenght
+    //plus/minus ten. This makes then always visible
+    setBorders(m_spectrum->minPeak()-10.0, m_spectrum->maxPeak()+10.0);
+}
+
 #include "spectrumwidget.moc"

--- trunk/KDE/kdeedu/kalzium/src/spectrumwidget.h #588164:588165
 @ -39,6 +39,7  @

 		void setSpectrum( Spectrum* spec ){
 			m_spectrum = spec;
+      restart();
 		}

 		Spectrum* spectrum()const{
 @ -59,12 +60,6  @

 			update();
 		}
-
-		/**
-		 * find the nearest band. The returned value is the number
-		 * of pixel the next band is away
-		 */
-		int findNearestBand( QList<double>::iterator it );

 		/**
 		 * there are several possible types.
 @ -130,8 +125,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
 @ -143,6 +136,9  @
 		void wavelengthToRGB( double wavelength, int& r, int& g, int& b );

 	private:
+    ///(re)create startconditions
+    void restart();
+
 		QList<double> m_spectra;

 		SpectrumType m_type;


More information about the Kalzium mailing list