if (m_Pixmap.isNull()) refreshPixmap();
draw(event->rect().x(), event->rect().y(), event->rect().width(), event->rect().height(),&p);
}
void xxx
::draw(int cx,
int cy,
int cw,
int ch,
QPainter* p
) { p->begin(viewport());
p->drawPixmap(0, 0, m_Pixmap);
p
->drawPixmap
(QRectF(cx
- this
->geometry
().
x(), cy
- this
->geometry
().
y(), cw, ch
), m_Pixmap,
QRectF(cx
- this
->geometry
().
x(), cy
- this
->geometry
().
y(), cw, ch
));
}
void xxx::paintEvent(QPaintEvent* event) {
QPainter p;
if (m_Pixmap.isNull()) refreshPixmap();
draw(event->rect().x(), event->rect().y(), event->rect().width(), event->rect().height(),&p);
}
void xxx::draw(int cx, int cy, int cw, int ch, QPainter* p) {
p->begin(viewport());
p->drawPixmap(0, 0, m_Pixmap);
p->drawPixmap(QRectF(cx - this->geometry().x(), cy- this->geometry().y(), cw, ch), m_Pixmap, QRectF(cx- this->geometry().x(), cy - this->geometry().y(), cw, ch));
}
To copy to clipboard, switch view to plain text mode
Bookmarks