Search code examples
qtwebkitscroll

Qt - focus on a specified area of webpage


I'm trying to create a plugin using QT that is able to open a webpage, yet I only want the window to be focused on a 300x300 pixel area. The area is somewhere in the middle of a page.

I was able to load the page and then perform a scrolling operation, but that doesn't seem very clean.

Does anyone know if this is possible? I checked the QtWebFrame class reference: http://doc.qt.io/archives/qt-4.7/qwebframe.html but maybe I'm missing something. Thanks in advance!


Solution

  • If you don't need interaction with the page, you could call QWebFrame::render(QPainter* painter, const QRegion& clip) and draw it onto a widget, specifying clip to be the required area.