itom 2.2.1
K:/git-itom/sources/itom/itomWidgets/doubleSlider.h
00001 /* ********************************************************************
00002     itom software
00003     URL: http://www.uni-stuttgart.de/ito
00004     Copyright (C) 2016, Institut fuer Technische Optik (ITO),
00005     Universitaet Stuttgart, Germany
00006 
00007     This file is part of itom and its software development toolkit (SDK).
00008 
00009     itom is free software; you can redistribute it and/or modify it
00010     under the terms of the GNU Library General Public Licence as published by
00011     the Free Software Foundation; either version 2 of the Licence, or (at
00012     your option) any later version.
00013    
00014     In addition, as a special exception, the Institut fuer Technische
00015     Optik (ITO) gives you certain additional rights.
00016     These rights are described in the ITO LGPL Exception version 1.0,
00017     which can be found in the file LGPL_EXCEPTION.txt in this package.
00018 
00019     itom is distributed in the hope that it will be useful, but
00020     WITHOUT ANY WARRANTY; without even the implied warranty of
00021     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
00022     General Public Licence for more details.
00023 
00024     You should have received a copy of the GNU Library General Public License
00025     along with itom. If not, see <http://www.gnu.org/licenses/>.
00026 
00027     This file is a port and modified version of the 
00028     Common framework (http://www.commontk.org)
00029 *********************************************************************** */
00030 
00031 #ifndef DOUBLESLIDER_H
00032 #define DOUBLESLIDER_H
00033 
00034 // Qt includes
00035 #include <QSlider>
00036 #include <QWidget>
00037 
00038 #include "commonWidgets.h"
00039 
00040 class DoubleSliderPrivate;
00041 class ValueProxy;
00042 
00052 class ITOMWIDGETS_EXPORT DoubleSlider : public QWidget
00053 {
00054   Q_OBJECT
00055   Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged USER true)
00056   Q_PROPERTY(double sliderPosition READ sliderPosition WRITE setSliderPosition)
00057   Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
00058   Q_PROPERTY(double pageStep READ pageStep WRITE setPageStep)
00059   Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
00060   Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
00061   Q_PROPERTY(double tickInterval READ tickInterval WRITE setTickInterval)
00062   Q_PROPERTY(QSlider::TickPosition tickPosition READ tickPosition WRITE setTickPosition)
00063   Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking)
00064   Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
00065   Q_PROPERTY(QString handleToolTip READ handleToolTip WRITE setHandleToolTip)
00066   Q_PROPERTY(bool invertedAppearance READ invertedAppearance WRITE setInvertedAppearance)
00067   Q_PROPERTY(bool invertedControls READ invertedControls WRITE setInvertedControls)
00068 
00069 public:
00071   typedef QWidget Superclass;
00072 
00075   explicit DoubleSlider(QWidget* parent = 0);
00078   explicit DoubleSlider(Qt::Orientation orient, QWidget* parent = 0);
00080   virtual ~DoubleSlider();
00081 
00087   void setMinimum(double min);
00088   double minimum()const;
00089 
00095   void setMaximum(double max);
00096   double maximum()const;
00097 
00101   void setRange(double min, double max);
00102 
00108   double value()const;
00109 
00116   void setSingleStep(double step);
00117   double singleStep()const;
00118 
00123   bool isValidStep(double step)const;
00124 
00130   void setPageStep(double step);
00131   double pageStep()const;
00132 
00138   void setTickInterval(double ti);
00139   double tickInterval()const;
00140 
00145   void setTickPosition(QSlider::TickPosition position);
00146   QSlider::TickPosition tickPosition()const;
00147   
00154   double sliderPosition()const;
00155   void setSliderPosition(double);
00156 
00163   void setTracking(bool enable);
00164   bool hasTracking()const;
00165   
00170   void triggerAction(QAbstractSlider::SliderAction action);
00171 
00175   Qt::Orientation orientation()const;
00176 
00186   void setInvertedAppearance(bool invertedAppearance);
00187   bool invertedAppearance()const;
00188 
00195   void setInvertedControls(bool invertedControls);
00196   bool invertedControls()const;
00197 
00203   QString handleToolTip()const;
00204   void setHandleToolTip(const QString& toolTip);
00205 
00207   virtual bool eventFilter(QObject*, QEvent*);
00208 
00217   void setValueProxy(ValueProxy* proxy);
00218   ValueProxy* valueProxy() const;
00219 
00220 public slots:
00226   void setValue(double value);
00227 
00231   void setOrientation(Qt::Orientation orientation);
00232 
00233 signals:
00237   void valueChanged(double value);
00238 
00244   void sliderMoved(double position);
00245   
00249   void sliderPressed();
00250   
00254   void sliderReleased();
00255 
00261   void rangeChanged(double min, double max);
00262 
00263 protected slots:
00264   void onValueChanged(int value);
00265   void onSliderMoved(int position);
00266   void onRangeChanged(int min, int max);
00267   void onValueProxyAboutToBeModified();
00268   void onValueProxyModified();
00269 
00270 protected:
00271   QScopedPointer<DoubleSliderPrivate> d_ptr;
00272 
00273 private:
00274   Q_DECLARE_PRIVATE(DoubleSlider);
00275   Q_DISABLE_COPY(DoubleSlider);
00276 };
00277 
00278 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Friends