From 75391ba7a5f4e3a249d486dc1315116dd9f6241f Mon Sep 17 00:00:00 2001 From: Carsten Niehaus Date: Wed, 13 Jul 2005 17:33:01 +0000 Subject: [PATCH] Some more thing: the spinboxes work now, label... svn path=/trunk/KDE/kdeedu/kalzium/src/spectrum.h; revision=434316 --- kalzium/src/spectrum.cpp | 9 +++++++++ kalzium/src/spectrum.h | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/kalzium/src/spectrum.cpp b/kalzium/src/spectrum.cpp index 54850b8..b241df7 100644 --- a/kalzium/src/spectrum.cpp +++ b/kalzium/src/spectrum.cpp @@ -20,6 +20,7 @@ #include "spectrum.h" #include +#include #include #include @@ -203,7 +204,15 @@ SpectrumView::SpectrumView( QWidget *parent, const char* name ) QHBoxLayout *hbox = new QHBoxLayout( this ); m_spinbox_left = new QSpinBox( 380, 779, 1, this ); m_spinbox_right = new QSpinBox( 381, 780, 1, this ); + m_spinbox_right->setValue( 700 ); + m_spinbox_left->setValue( 400 ); + + connect( m_spinbox_right, SIGNAL( valueChanged( int ) ), m_spectrum, SLOT( setRightBorder( int ) ) ); + connect( m_spinbox_left, SIGNAL( valueChanged( int ) ), m_spectrum, SLOT( setLeftBorder( int ) ) ); + + hbox->addWidget( new QLabel( i18n( "Minimumvalue" ), this ) ); hbox->addWidget( m_spinbox_left ); + hbox->addWidget( new QLabel( i18n( "Maximumvalue" ), this ) ); hbox->addWidget( m_spinbox_right ); spectrumLayout->addLayout( hbox ); diff --git a/kalzium/src/spectrum.h b/kalzium/src/spectrum.h index 7bdcdd0..504b955 100644 --- a/kalzium/src/spectrum.h +++ b/kalzium/src/spectrum.h @@ -103,6 +103,27 @@ class SpectrumWidget : public QWidget int m_realHeight; double m_stretch; + + public slots: + /** + * set the the minimumvalue to @p value + */ + void setRightBorder( int value ){ + endValue = value; + if ( endValue < startValue ) + startValue = endValue-1; + update(); + } + + /** + * set the the maximumvalue to @p value + */ + void setLeftBorder( int value ){ + startValue = value; + if ( startValue > endValue ) + endValue = startValue+1; + update(); + } protected: virtual void paintEvent( QPaintEvent *e ); -- 2.47.3