cmtkQtSliderEntry.h

Go to the documentation of this file.
00001 /*
00002 //
00003 //  Copyright 1997-2009 Torsten Rohlfing
00004 //  Copyright 2004-2009 SRI International
00005 //
00006 //  This file is part of the Computational Morphometry Toolkit.
00007 //
00008 //  http://www.nitrc.org/projects/cmtk/
00009 //
00010 //  The Computational Morphometry Toolkit is free software: you can
00011 //  redistribute it and/or modify it under the terms of the GNU General Public
00012 //  License as published by the Free Software Foundation, either version 3 of
00013 //  the License, or (at your option) any later version.
00014 //
00015 //  The Computational Morphometry Toolkit is distributed in the hope that it
00016 //  will be useful, but WITHOUT ANY WARRANTY; without even the implied
00017 //  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 //  GNU General Public License for more details.
00019 //
00020 //  You should have received a copy of the GNU General Public License along
00021 //  with the Computational Morphometry Toolkit.  If not, see
00022 //  <http://www.gnu.org/licenses/>.
00023 //
00024 //  $Revision: 970 $
00025 //
00026 //  $LastChangedDate: 2009-12-03 17:34:37 -0800 (Thu, 03 Dec 2009) $
00027 //
00028 //  $LastChangedBy: torstenrohlfing $
00029 //
00030 */
00031 
00032 #ifndef __cmtkQtSliderEntry_h_included_
00033 #define __cmtkQtSliderEntry_h_included_
00034 
00035 #include <cmtkconfig.h>
00036 
00037 #include <qwidget.h>
00038 #include <qslider.h>
00039 #include <qlabel.h>
00040 #include <qlineedit.h>
00041 #include <qvalidator.h>
00042 #include <qlayout.h>
00043 
00044 #include <QGridLayout>
00045 
00046 namespace
00047 cmtk
00048 {
00049 
00052 
00055 class QtSliderEntry :
00057   public QWidget
00058 {
00059   Q_OBJECT // we use slots and signals.
00060 
00061 public:
00063   QtSliderEntry( QWidget* parent );
00064 
00066   double GetValue() const;
00067 
00069   double GetMinValue() const;
00070 
00072   double GetMaxValue() const;
00073 
00074 signals:
00076   void valueChanged( double value );
00077 
00078 public slots:
00080   void slotSetTitle( const QString& title );
00081 
00083   void slotSetMinMaxLabels( const QString& minLabel, const QString& maxLabel );
00084 
00086   void slotSetRange( double rangeFrom, double rangeTo );
00087 
00089   void slotSetPrecision( int precision );
00090 
00092   void slotSetValue( const double value );
00093 
00095   void slotCenter();
00096 
00097 private slots:
00099   void slotEditReturnPressed();
00100 
00102   void slotSliderValueChanged( int value );
00103 
00104 private:
00106   uint Precision;
00107 
00109   uint PrecisionFactor;
00110   
00112   QGridLayout* Layout;
00113 
00115   QSlider* Slider;
00116   
00118   QLineEdit* Edit;
00119 
00121   QDoubleValidator* Validator;
00122 
00124   QLabel* TitleLabel;
00125 
00127   QLabel* MinLabel;
00128 
00130   QLabel* MaxLabel;
00131 
00132 };
00133 
00135 
00136 } // namespace cmtk
00137 
00138 #endif // #ifndef __cmtkQtSliderEntry_h_included_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines