From 921405f814becec0ce68c35ca2415cd090474188 Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Wed, 27 Oct 2010 21:01:41 +0000 Subject: Fixed redrawing of meter drawContents -> paintEvent --- muse2/muse/mixer/meter.cpp | 8 +++++--- muse2/muse/mixer/meter.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'muse2') diff --git a/muse2/muse/mixer/meter.cpp b/muse2/muse/mixer/meter.cpp index fc010a33..993a15ff 100644 --- a/muse2/muse/mixer/meter.cpp +++ b/muse2/muse/mixer/meter.cpp @@ -102,8 +102,10 @@ void Meter::setRange(double min, double max) // paintEvent //--------------------------------------------------------- -void Meter::drawContents(QPainter* p) +void Meter::paintEvent(QPaintEvent*) { + QPainter p; + p.begin(this); double range = maxScale - minScale; int fw = frameWidth(); @@ -122,8 +124,8 @@ void Meter::drawContents(QPainter* p) ymax = maxVal == 0 ? 0 : int(((maxScale - (fast_log10(maxVal) * 20.0)) * h)/range); else ymax = maxVal == 0 ? 0 : int(((maxScale - maxVal) * h)/range); - p->setPen(Qt::white); - p->drawLine(0, ymax, width()-2*fw, ymax); + p.setPen(Qt::white); + p.drawLine(0, ymax, width()-2*fw, ymax); } //--------------------------------------------------------- diff --git a/muse2/muse/mixer/meter.h b/muse2/muse/mixer/meter.h index 719ab701..5f072335 100644 --- a/muse2/muse/mixer/meter.h +++ b/muse2/muse/mixer/meter.h @@ -33,6 +33,7 @@ class Meter : public QFrame { void drawVU(int w, int h); Q_OBJECT + void paintEvent(QPaintEvent*); virtual void drawContents(QPainter* p); virtual void resizeEvent(QResizeEvent*); virtual void mousePressEvent(QMouseEvent*); -- cgit v1.2.3