ctkRangeWidget.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Library:   CTK
00004  
00005   Copyright (c) 2010  Kitware Inc.
00006 
00007   Licensed under the Apache License, Version 2.0 (the "License");
00008   you may not use this file except in compliance with the License.
00009   You may obtain a copy of the License at
00010 
00011       http://www.commontk.org/LICENSE
00012 
00013   Unless required by applicable law or agreed to in writing, software
00014   distributed under the License is distributed on an "AS IS" BASIS,
00015   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016   See the License for the specific language governing permissions and
00017   limitations under the License.
00018  
00019 =========================================================================*/
00020 
00021 #ifndef __ctkRangeWidget_h
00022 #define __ctkRangeWidget_h
00023 
00024 // Qt includes
00025 #include <QSlider>
00026 
00027 // CTK includes
00028 #include <ctkPimpl.h>
00029 
00030 #include "CTKWidgetsExport.h"
00031 
00032 class ctkRangeWidgetPrivate;
00033 
00034 class CTK_WIDGETS_EXPORT ctkRangeWidget : public QWidget
00035 {
00036   Q_OBJECT
00037   Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
00038   Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
00039   Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
00040   Q_PROPERTY(int decimals READ decimals WRITE setDecimals)
00041   Q_PROPERTY(double minimumValue READ minimumValue WRITE setMinimumValue)
00042   Q_PROPERTY(double maximumValue READ maximumValue WRITE setMaximumValue)
00043   Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
00044   Q_PROPERTY(QString suffix READ suffix WRITE setSuffix)
00045   Q_PROPERTY(double tickInterval READ tickInterval WRITE setTickInterval)
00046   Q_PROPERTY(bool autoSpinBoxWidth READ isAutoSpinBoxWidth WRITE setAutoSpinBoxWidth)
00047   Q_PROPERTY(Qt::Alignment spinBoxAlignment READ spinBoxAlignment WRITE setSpinBoxAlignment)
00048   Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking)
00049 
00050 public:
00052   typedef QWidget Superclass;
00053 
00055   explicit ctkRangeWidget(QWidget* parent = 0);
00056 
00063   double minimum()const;
00064   void setMinimum(double minimum);
00065   
00072   double maximum()const;
00073   void setMaximum(double maximum);
00076   void setRange(double min, double max);
00077 
00082   double minimumValue()const;
00083 
00088   double maximumValue()const;
00089 
00095   double singleStep()const;
00096   void setSingleStep(double step);
00097 
00101   int decimals()const;
00102   void setDecimals(int decimals);
00103 
00108   QString prefix()const;
00109   void setPrefix(const QString& prefix);
00110 
00115   QString suffix()const;
00116   void setSuffix(const QString& suffix);
00117 
00123   double tickInterval()const;
00124   void setTickInterval(double ti);
00125 
00130   void setSpinBoxAlignment(Qt::Alignment alignment);
00131   Qt::Alignment spinBoxAlignment()const;
00132 
00139   void setTracking(bool enable);
00140   bool hasTracking()const;
00141 
00146   // ctkRangeWidget siblings.
00147   bool isAutoSpinBoxWidth()const;
00148   void setAutoSpinBoxWidth(bool autoWidth);
00149 
00150 public slots:
00153   void reset();
00154   void setMinimumValue(double value);
00155   void setMaximumValue(double value);
00158   void setValues(double minValue, double maxValue);
00159 
00160 signals:
00163   //void sliderMoved(double position);
00164   void minimumValueChanged(double value);
00165   void minimumValueIsChanging(double value);
00166   void maximumValueChanged(double value);
00167   void maximumValueIsChanging(double value);
00168 
00169 protected slots:
00170   void startChanging();
00171   void stopChanging();
00172   void changeMinimumValue(double value);
00173   void changeMaximumValue(double value);
00174   void setMinimumToMaximumSpinBox(double minimum);
00175   void setMaximumToMinimumSpinBox(double maximum);
00176   
00177 protected:
00178   virtual bool eventFilter(QObject *obj, QEvent *event);
00179 private:
00180   CTK_DECLARE_PRIVATE(ctkRangeWidget);
00181 
00182 };
00183 
00184 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated on 21 May 2010 for CTK by  doxygen 1.6.1