kwave
18.07.70
|
#include <ScaleWidget.h>
Public Member Functions | |
ScaleWidget (QWidget *parent) | |
ScaleWidget (QWidget *parent, int low, int high, const QString &unit) | |
virtual | ~ScaleWidget () Q_DECL_OVERRIDE |
void | setMinMax (int min, int max) |
void | setUnit (const QString &text) |
void | setLogMode (bool log) |
virtual QSize | minimumSize () const |
virtual QSize | sizeHint () const Q_DECL_OVERRIDE |
Protected Member Functions | |
virtual void | paintEvent (QPaintEvent *) Q_DECL_OVERRIDE |
void | drawLinear (QPainter &p, int w, int h, bool inverse) |
void | drawLog (QPainter &p, int w, int h, bool inverse) |
void | paintText (QPainter &p, int x, int y, bool reverse, const QString &text) |
Private Attributes | |
int | m_low |
int | m_high |
bool | m_logmode |
QString | m_unittext |
Definition at line 33 of file ScaleWidget.h.
|
explicit |
Primitve constructor for usage in a Qt designer's dialog
parent | the widget's parent widget |
Definition at line 37 of file ScaleWidget.cpp.
Kwave::ScaleWidget::ScaleWidget | ( | QWidget * | parent, |
int | low, | ||
int | high, | ||
const QString & | unit | ||
) |
Constructor with initialization.
parent | the widget's parent widget |
low | left/lower border value |
high | right/upper border value |
unit | text of the units to show |
Definition at line 44 of file ScaleWidget.cpp.
|
virtual |
|
protected |
Draws a linear scale
p | reference to the painter |
w | width of the drawing area in pixels |
h | height of the drawing area in pixels |
inverse | of true, the coordinate system is rotated to be upside-down and the scale has to be drawn mirrored in x and y axis. |
Definition at line 164 of file ScaleWidget.cpp.
References _, FONTSIZE, m_high, m_low, m_unittext, paintText(), and Kwave::toInt().
Referenced by paintEvent().
|
protected |
Definition at line 107 of file ScaleWidget.cpp.
References _, FONTSIZE, m_high, m_low, m_unittext, paintText(), and Kwave::toInt().
Referenced by paintEvent().
|
virtual |
minimum size of the widtget,
Definition at line 237 of file ScaleWidget.cpp.
References FONTSIZE.
|
protectedvirtual |
Draws the widget.
Definition at line 203 of file ScaleWidget.cpp.
References drawLinear(), drawLog(), and m_logmode.
|
protected |
Painting routine for own small font with fixed size There are Problems with smaller displays using QFont, sizes are not correct.
p | reference to the painter |
x | coordinate of the left edge of the first character |
y | coordinate of the lower edge of the first character |
reverse | if true, print reverse: x is right edge of the text, like "align right". |
text | the text to be printed. Must only contain known characters that are present in the font bitmap, like numbers, letters and some special chars like "%", space, dot and comma. |
Definition at line 81 of file ScaleWidget.cpp.
References FONTSIZE, and rect().
Referenced by drawLinear(), and drawLog().
void Kwave::ScaleWidget::setLogMode | ( | bool | log | ) |
Sets logarithmic or linear mode.
log | if true, set logarithmic mode, if not select linear mode |
Definition at line 64 of file ScaleWidget.cpp.
References m_logmode.
void Kwave::ScaleWidget::setMinMax | ( | int | min, |
int | max | ||
) |
Sets the border values.
min | left/lower border value |
max | right/upper border value |
Definition at line 72 of file ScaleWidget.cpp.
Referenced by Kwave::SonagramWindow::updateScaleWidgets().
void Kwave::ScaleWidget::setUnit | ( | const QString & | text | ) |
Set the text of the units.
text | the units to show |
Definition at line 57 of file ScaleWidget.cpp.
References m_unittext.
|
virtual |
optimal size for the widget,
Definition at line 231 of file ScaleWidget.cpp.
References FONTSIZE.
Referenced by Kwave::SonagramWindow::SonagramWindow().
|
private |
Upper boundary value
Definition at line 128 of file ScaleWidget.h.
Referenced by drawLinear(), drawLog(), and setMinMax().
|
private |
If true, logarithmic mode, linear mode if false
Definition at line 131 of file ScaleWidget.h.
Referenced by paintEvent(), and setLogMode().
|
private |
Lower boundary value
Definition at line 125 of file ScaleWidget.h.
Referenced by drawLinear(), drawLog(), and setMinMax().
|
private |
String containing the name of the unit
Definition at line 134 of file ScaleWidget.h.
Referenced by drawLinear(), drawLog(), and setUnit().