]> Git trees. - libqmvoc.git/commitdiff
Some more thing: the spinboxes work now, label...
authorCarsten Niehaus <cniehaus@gmx.de>
Wed, 13 Jul 2005 17:33:01 +0000 (17:33 +0000)
committerCarsten Niehaus <cniehaus@gmx.de>
Wed, 13 Jul 2005 17:33:01 +0000 (17:33 +0000)
svn path=/trunk/KDE/kdeedu/kalzium/src/spectrum.h; revision=434316

kalzium/src/spectrum.cpp
kalzium/src/spectrum.h

index 54850b8fd6e111b284f47cf13a7608e47f7e7b99..b241df771628a1e7a42ef5a9e3b8ace17c4e6362 100644 (file)
@@ -20,6 +20,7 @@
 #include "spectrum.h"
 
 #include <qlayout.h>
+#include <qlabel.h>
 
 #include <kglobal.h>
 #include <kstandarddirs.h>
@@ -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 );
index 7bdcdd0d55f0c372b3fd4778690af3c526308786..504b955a108137df8ceb75f37d63c8e9b3536b0d 100644 (file)
@@ -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 );