Thanks to all for the replies.
The code is compiled in Qt 4 only.
Marcel,
I had actually created a paintEvent in the PBS class before posting my question, but it didn't work either. The code is below. Nothing is painted when this event is called either, but at least I don't get the original error message. The program I'm trying to port works quite nicely in Qt 3, and displays both spectrum and waterfall displays. I've never noticed any flickering. I have no problems with rewriting some of the code, if I can ever get the painting problem solved. Seems like I'm still missing something here ...
Note that nothing is painted anywhere on the screen when the paintEvent in PBS is executed.
Code follows ....................................
#include "pbs.h"
#include "main_widget.h"
PBS::PBS(QWidget *parent) : QWidget(parent)
{
setMouseTracking( true );
}
void PBS::mouseMoveEvent( QMouseEvent *e )
{
emit movement( e->x() );
}
void PBS::mousePressEvent( QMouseEvent *e )
{
x0 = e->x();
if ( e->button() == Qt::LeftButton )
emit set_lower_pb( x0 );
if ( e->button() == Qt::RightButton )
emit set_upper_pb( x0 );
}
void PBS:aintEvent( QPaintEvent * )
{
printf("PBS paintEvent() \n");
QPainter p;
p.begin(this);
// p.eraseRect( 0, 0, this->width(), this->height() );
p.setPen( Qt::yellow );
p.drawLine(252, 50, 252, 190);
p.drawLine(4,115,34,115);
p.end();
}
Bookmarks