Hi,
I want to render a specific part of a web page when using the QWebView widget. I've created a subclass of QWebView and I've overridden the paintEvent method. The code for the paintEvent method is below:
{
if (!page())
return;
// specify the region we want to paint
QRegion region
(QRect(1,
1,
587,
483));
// x, y, width, height
QWebFrame *frame = page()->mainFrame();
frame->render(&p, region);
}
void MyWidget::paintEvent(QPaintEvent *ev)
{
if (!page())
return;
QPainter p(this);
// specify the region we want to paint
QRegion region(QRect(1, 1, 587, 483)); // x, y, width, height
QWebFrame *frame = page()->mainFrame();
frame->render(&p, region);
}
To copy to clipboard, switch view to plain text mode
The only problem i have is that when i resize the window that contains my subclass of QWebView then i get visual artifacts. Is there something i should do after i call frame->render()?
John
Bookmarks