ctkSliderSpinBoxWidget.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 __ctkSliderSpinBoxWidget_h
00022 #define __ctkSliderSpinBoxWidget_h
00023 
00024 // Qt includes
00025 #include <QSlider>
00026 
00027 // CTK includes
00028 #include <ctkPimpl.h>
00029 
00030 #include "CTKWidgetsExport.h"
00031 
00032 class ctkSliderSpinBoxWidgetPrivate;
00033 
00034 class CTK_WIDGETS_EXPORT ctkSliderSpinBoxWidget : 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 value READ value WRITE setValue)
00040   Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
00041   Q_PROPERTY(int decimals READ decimals WRITE setDecimals)
00042   Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
00043   Q_PROPERTY(QString suffix READ suffix WRITE setSuffix)
00044   Q_PROPERTY(double tickInterval READ tickInterval WRITE setTickInterval)
00045   Q_PROPERTY(bool autoSpinBoxWidth READ isAutoSpinBoxWidth WRITE setAutoSpinBoxWidth)
00046   Q_PROPERTY(Qt::Alignment spinBoxAlignment READ spinBoxAlignment WRITE setSpinBoxAlignment)
00047   Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking)
00048 
00049 public:
00051   typedef QWidget Superclass;
00052 
00054   explicit ctkSliderSpinBoxWidget(QWidget* parent = 0);
00055   virtual ~ctkSliderSpinBoxWidget(){}
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 
00081   //double sliderPosition()const;
00082   //void setSliderPosition(double position);
00083 
00088   double value()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   // ctkSliderSpinBoxWidget siblings.
00147   bool isAutoSpinBoxWidth()const;
00148   void setAutoSpinBoxWidth(bool autoWidth);
00149 
00150 public slots:
00153   void reset();
00154   void setValue(double value);
00155 
00156 signals:
00159   //void sliderMoved(double position);
00160   void valueChanged(double value);
00161   void valueIsChanging(double value);
00162 
00163 protected slots:
00164   
00165   void startChanging();
00166   void stopChanging();
00167   void changeValue(double value);
00168   
00169 protected:
00170   virtual bool eventFilter(QObject *obj, QEvent *event);
00171   
00172 private:
00173   CTK_DECLARE_PRIVATE(ctkSliderSpinBoxWidget);
00174 
00175 };
00176 
00177 #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