kwave  18.07.70
ScaleWidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  ScaleWidget.h - widget for drawing a scale under an image
3  -------------------
4  begin : Sep 18 2001
5  copyright : (C) 2001 by Thomas Eschenbacher
6  email : Thomas Eschenbacher <thomas.eschenbacher@gmx.de>
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef SCALE_WIDGET_H
19 #define SCALE_WIDGET_H
20 
21 #include "config.h"
22 
23 #include <QtGlobal>
24 #include <QString>
25 #include <QWidget>
26 
27 class QPaintEvent;
28 class QPainter;
29 class QSize;
30 
31 namespace Kwave
32 {
33  class Q_DECL_EXPORT ScaleWidget: public QWidget
34  {
35  public:
36 
41  explicit ScaleWidget(QWidget *parent);
42 
50  ScaleWidget(QWidget *parent, int low, int high, const QString &unit);
51 
53  virtual ~ScaleWidget() Q_DECL_OVERRIDE;
54 
60  void setMinMax(int min, int max);
61 
66  void setUnit(const QString &text);
67 
73  void setLogMode(bool log);
74 
76  virtual QSize minimumSize() const;
77 
79  virtual QSize sizeHint() const Q_DECL_OVERRIDE;
80 
81  protected:
82 
87  virtual void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
88 
98  void drawLinear(QPainter &p, int w, int h, bool inverse);
99 
103  void drawLog(QPainter &p, int w, int h, bool inverse);
104 
119  void paintText(QPainter &p, int x, int y,
120  bool reverse, const QString &text);
121 
122  private:
123 
125  int m_low;
126 
128  int m_high;
129 
131  bool m_logmode;
132 
134  QString m_unittext;
135 
136  };
137 }
138 
139 #endif // SCALE_WIDGET_H
140 
141 //***************************************************************************
142 //***************************************************************************
Definition: App.h:33