void GraphView::paintEvent(QPaintEvent* ev)
{
- Q_UNUSED(ev);
-
- QPainter p(this);
- if (m_pixmap != nullptr)
- p.drawPixmap(0, 0, dwidth(), dheight(), *m_pixmap);
+ if (m_pixmap != nullptr) {
+ QPainter p(this);
+ const QVector<QRect> &rects = ev->region().rects();
+
+ for (const QRect& r : rects) {
+ const int l = r.left();
+ const int t = r.top();
+ const int w = r.width();
+ const int h = r.height();
+ p.drawPixmap(l, t, w, h, *m_pixmap, l, t, w, h);
+ }
+ }
}
void GraphView::resizeEvent(QResizeEvent* ev)