views:

825

answers:

2

I got a QtWebKit.QWebView widget in a PyQt application window that I use to display text and stuff for a chat-like application.

    self.mainWindow = QtWebKit.QWebView()
    self.mainWindow.setHtml(self._html)

As the conversation gets longer the vertical scrollbar appears.

What I'd like to get, is to scroll the displayed view to the bottom when it's needed. How can I do it? Or, maybe, I shouldn't use QWebView widget for this?

+1  A: 

Hey, kender - The QWebView is made up of a QWebPage and a QWebFrame. The scroll bar properties are stored in the QWebFrame, which has a setScrollBarValue() method, as well as a scrollBarMaximum() method to return the max position.

See these links for details: QWebView, QWebFrame

jcoon
+1  A: 

For (Py)Qt 4.5, use frame's scroll position, e.g. self._html.page().mainFrame().setScrollPosition. See QWebFrame::setScrollPosition() function..

Ariya Hidayat