[PyQt] Scrollbars appearing when not needed?

Chris Wood c.c.wood at gmail.com
Thu May 15 16:42:06 BST 2014


Hello all,

I can provide simplified code for this if needed, but perhaps an 
explanation will suffice for now.

I have a HTML page which has just 1 div, of size 200px x 200px, with a 1 
px border, and all padding / margins are set to 0 in my stylesheet

I then create a QWebView widget (in Qt Designer), of size (and 
maximumSize) 202 x 202, and embed it within a larger widget. Compiling 
the .ui file and opening the widget causes scrollbars to be displayed 
around the QWebWidget.  Forcing the scrollbars to be hidden,

       frame.setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff)
       frame.setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff)

confirms that the QWebView is the correct size, and that the border is 
visible (i.e. the webpage is not larger than 202x202).

Why are the scrollbars appearing? Is this documented / expected behaviour?

Thanks,
Chris


More information about the PyQt mailing list