1 /***************************************************************************
2 copyright : (C) 2005, 2006 by Carsten Niehaus
3 email : cniehaus@kde.org
4 ***************************************************************************/
5 /***************************************************************************
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. *
12 ***************************************************************************/
13 #include "spectrumviewimpl.h"
16 #include <QTreeWidget>
20 SpectrumViewImpl::SpectrumViewImpl( QWidget
*parent
)
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
;
42 foreach (Spectrum::peak
* peak
, m_spectrumWidget
->spectrum()->peaklist())
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
));
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"