Summary: | Spectrum should reset to full width when selecting another element | ||
---|---|---|---|
Product: | [Applications] kalzium | Reporter: | Eckhart Wörner <ewoerner> |
Component: | general | Assignee: | Kalzium Developers <kalzium> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Eckhart Wörner
2006-09-14 21:57:17 UTC
SVN commit 588032 by cniehaus: Fix the spectrum-bug in trunk... Now I need somebody who has KDE 3.5 and backports. I have 45mb left on my harddisc so there is no way I can install kde3-developent-stuff... BUGS:134086 M +13 -9 detailinfodlg.cpp --- trunk/KDE/kdeedu/kalzium/src/detailinfodlg.cpp #588031:588032 @@ -523,15 +523,19 @@ // updating spectrum widget if ( m_element->spectrum() ) - { - m_spectrumview->setSpectrum( m_element->spectrum() ); - m_spectrumStack->setCurrentWidget( m_spectrumview ); - } - else - { - m_spectrumLabel->setText( i18n( "No spectrum of %1 found.", element_name ) ); - m_spectrumStack->setCurrentWidget( m_spectrumLabel ); - } + { + 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 + { + m_spectrumLabel->setText( i18n( "No spectrum of %1 found.", element_name ) ); + m_spectrumStack->setCurrentWidget( m_spectrumLabel ); + } } void DetailedInfoDlg::slotHelp() 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; |