Test change - can I push OK?
[kdeedu-porting.git] / kalzium / src / spectrumviewimpl.cpp
blob22438afd1508d174f5f804d38f3e9fd1e7bb8323
1 /***************************************************************************
2 copyright : (C) 2005, 2006 by Carsten Niehaus
3 email : cniehaus@kde.org
4 ***************************************************************************/
5 /***************************************************************************
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 ***************************************************************************/
13 #include "spectrumviewimpl.h"
15 #include <QSpinBox>
16 #include <QTreeWidget>
18 #include <kdebug.h>
20 SpectrumViewImpl::SpectrumViewImpl( QWidget *parent )
21 : QWidget( parent )
23 setupUi( this );
25 connect( minimumValue, SIGNAL( valueChanged( int ) ),
26 m_spectrumWidget, SLOT( setLeftBorder( int ) ) );
27 connect( maximumValue, SIGNAL( valueChanged( int ) ),
28 m_spectrumWidget, SLOT( setRightBorder( int ) ) );
29 connect( m_spectrumWidget, SIGNAL( bordersChanged(int,int) ),
30 this, SLOT( updateUI(int,int) ) );
31 connect(m_spectrumWidget, SIGNAL(peakSelected(Spectrum::peak*)),
32 this, SLOT(updatePeakInformation(Spectrum::peak*)));
34 resize( minimumSizeHint() );
37 void SpectrumViewImpl::fillPeakList()
39 QList<QTreeWidgetItem *> items;
41 int num = 1;
42 foreach (Spectrum::peak * peak , m_spectrumWidget->spectrum()->peaklist())
44 QStringList l;
45 l << QString::number(num);
46 l << QString::number(peak->wavelength);
47 l << QString::number(peak->intensity);
48 items.append(new QTreeWidgetItem((QTreeWidget*)0, l));
50 num++;
53 peakList->insertTopLevelItems(0, items);
57 void SpectrumViewImpl::updateUI(int l, int r)
59 minimumValue->setValue(l);
60 maximumValue->setValue(r);
61 minimumValue->setRange(l,r-1);
62 maximumValue->setRange(l+1,r);
65 void SpectrumViewImpl::updatePeakInformation(Spectrum::peak * peak )
67 intensity_label->setText(i18n("%1 of 1000", peak->intensity));
68 wavelength_label->setText(i18n("%1 nm", peak->wavelength));
72 #include "spectrumviewimpl.moc"