April 2018
Beginner
714 pages
18h 21m
English
Now, it should be very easy for you to implement this approach for our example widget. The main difference is that each change to the plot contents should not result in a call to update() but in a call that will rerender the pixmap and then call update(). The paintEvent method then becomes simply this:
void Widget::paintEvent(QPaintEvent *event)
{
QRect exposedRect = event->rect();
QPainter painter(this);
painter.drawPixmap(exposedRect, m_pixmap, exposedRect);
}
You'll also need to rerender the pixmap when the widget is resized. This can be done from within the resizeEvent() virtual function.
Read now
Unlock full access