[PyQt] Scrollbars appearing when not needed?

Chris Wood c.c.wood at gmail.com
Fri May 16 14:26:50 BST 2014


On 16/05/2014 11:54, David Boddie wrote:
> On Thu May 15 16:42:06 BST 2014, Chris Wood wrote:
>
>> 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)
> What is frame? Is it the QWebView?
Yes - it is the QWebView
>
>> 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?
> Do they appear when you disable them using the two lines of code above?
No - they disappear totally and don't appear when the QMainWindow is 
resized.
> There may be other decoration that reduces the space available to the widget
> or its contents. Have you verified that the QWebView is actually 202 x 202
> pixels when the application runs?
Unless there's something else I've missed, I'd have thought the fact 
that the border appears (and that there is no whitespace around it) does 
confirm thatthe QWebView is 202 x 202 pixels?

> David
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt



More information about the PyQt mailing list