Pencil2D  ff90c0872e88be3bf81c548cd60f01983012ec49
Pencil2D is an animation software for both bitmap and vector graphics. It is free, multi-platform, and open source.
 All Classes Functions
spinslider.h
1 /*
2 
3 Pencil - Traditional Animation Software
4 Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5 Copyright (C) 2012-2017 Matthew Chiawen Chang
6 
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; version 2 of the License.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 */
17 
18 
19 #ifndef SPINSLIDER_H
20 #define SPINSLIDER_H
21 
22 #include <QWidget>
23 
24 class QLabel;
25 class QSlider;
26 class QStyle;
27 
28 
29 class SpinSlider : public QWidget
30 {
31  Q_OBJECT
32 public:
33  enum GROWTH_TYPE
34  {
35  LINEAR,
36  LOG,
37  EXPONENT,
38  };
39 
40  enum VALUE_TYPE
41  {
42  INTEGER,
43  FLOAT,
44  };
45 
46  SpinSlider( QString text, GROWTH_TYPE, VALUE_TYPE, qreal min, qreal max, QWidget* parent = 0 );
47  void setValue( qreal );
48  void setPixelPos(qreal min, qreal max, int val, int space, bool upsideDown);
49  void setExponent( const qreal );
50 
51 signals:
52  void valueChanged(qreal);
53 
54 private:
55  void onSliderValueChanged( int );
56  void changeValue( qreal );
57 
58 private:
59  QSlider* mSlider = nullptr;
60  qreal mValue = 50.0;
61  qreal mMin = 0.1;
62  qreal mMax = 100.0;
63  qreal mExp = 2.0;
64 
65  GROWTH_TYPE mGrowthType = LINEAR;
66  VALUE_TYPE mValueType = INTEGER;
67 };
68 
69 #endif // SPINSLIDER_H