dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
textbubbleslider.h
Go to the documentation of this file.
1 
12 /*
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * for more details.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, see <http://www.gnu.org/licenses/>
25 */
26 
27 #ifndef TEXTBUBBLESLIDER_H
28 #define TEXTBUBBLESLIDER_H
29 
30 #include <QSlider>
31 
32 class TextBubbleSlider : public QSlider
33 {
34  Q_OBJECT
35 
36 public:
37  explicit TextBubbleSlider(QWidget *parent = nullptr);
38  explicit TextBubbleSlider(QSlider *, QWidget *parent = nullptr);
39  void construct();
41 
42  void setMinimum(int);
43  void setMaximum(int);
44  void setHidden(bool);
45 
46 public slots:
47  void setIndicatorValue(int us);
48 
49 protected:
50  void paintEvent(QPaintEvent *event);
51  qreal sliderPosFromValue(const int val);
52 
53 private:
54  void setMaxPixelWidth();
55 
56  QFont font;
57  int maximumFontWidth;
58  int maximumFontHeight;
59  int slideHandleWidth;
60  int slideHandleMargin;
61  bool hidden;
62  int indicatorValue;
63 };
64 
65 #endif // TEXTBUBBLESLIDER_H
TextBubbleSlider(QWidget *parent=nullptr)
TextBubbleSlider::TextBubbleSlider Constructs a regular text-bubble slider.
qreal sliderPosFromValue(const int val)
void setMaximum(int)
TextBubbleSlider::setMaximum Reimplements setMaximum. Ensures that the slider handle is the correct s...
void setHidden(bool)
Hide the slider by not painting it.
void setMinimum(int)
TextBubbleSlider::setMinimum Reimplements setMinimum. Ensures that the slider handle is the correct s...
void construct()
TextBubbleSlider::construct This function needs to be called from all constructors. It provides a single point where settings can be changed.
void setIndicatorValue(int us)
void paintEvent(QPaintEvent *event)
TextBubbleSlider::paintEvent Reimplements QSlider::paintEvent.