Re: Help needed to develop an audio editor
Quote:
Originally Posted by
axeljaeger
If you show me your code, I will have a look at it.
Hi,
I started writing some code.
The class interface:
Code:
#ifndef __WAVEFORMDISPLAY_H__
#define __WAVEFORMDISPLAY_H__
#include <QWidget>
class WaveFormDisplay
: public QWidget{
Q_OBJECT
public:
WaveFormDisplay
( QWidget* parent
= 0 );
protected:
private:
};
#endif //__WAVEFORMDISPLAY_H__
And the methods:
Code:
#include "waveformdisplay.h"
WaveFormDisplay
::WaveFormDisplay( QWidget* parent
/* = 0 */ ){
setAutoFillBackground(true);
setWindowTitle( tr("Waveform display") );
resize(500, 200);
}
// Paint event
{
QLine line
( 0, height
() / 2.0, width
(), height
() / 2.0 );
QPen pen
( Qt
::blue,
1 );
// red solid line, 1 pixels wide
painter.setPen( pen );
painter.
setRenderHint( QPainter::Antialiasing );
painter.drawLine(line);
}
// Mouse press event
{
event->accept();
}
// Mouse move event
{
event->accept();
}
// Mouse release event
{
event->accept();
}
Do you already have some suggestions? Code is just to start and I already got linker error about mouse event :(
Re: Help needed to develop an audio editor
If you would have shown as the error message of the linker, it would be a lot easier to help.
Anyway, in this simple case I guess you just forgot the WaveFormDisplay:: in the method signature of your implementation to the linker does not know that the three mouse-event-handler belong to your class.
But also some comments to your code:
- Why do you "accept" the mouse-events already?
- Although it is good to write documentation, you "document the obvious": http://freeworld.thc.org/root/phun/unmaintain.html