I think it should be something like
{
painter.drawLine( xs, ys, xe, ye );
}
DrawingFunctions::paintEvent( QPaintEvent* event)
{
QPainter painter(this);
painter.drawLine( xs, ys, xe, ye );
}
To copy to clipboard, switch view to plain text mode
The points are calculated somewhere else and on every piantEvent the line is drawn. If you are not able to see the line then check if the co-ordiantes are negative or beyond the widget's size.
I think the buffer part i.e.
QPainter p
( drawings
);
/// set drawing pixmap
QPainter p( drawings ); /// set drawing pixmap
QPainter b( buffer ) ;
To copy to clipboard, switch view to plain text mode
is not needed since from Qt 4.0, QWidget automatically double-buffers its painting, so there's no need to write double-buffering code in paintEvent() to avoid flicker.
I think you can first try out painting examples that come with Qt to get a better picture of the whole thing.
Bookmarks