[Interest] padding around a QTextEdit/QTextBrowser viewport

Hamish Moffatt hamish at risingsoftware.com
Thu Jul 18 09:10:14 CEST 2013


Hi,

I have a QTextBrowser I'm using to display some documents. I want to add 
some padding around the edges, which means between the text (viewport) 
and the scroll bar on the right/bottom edges, and I'm not having much luck.

I tried adding padding to the QTextBrowser widget via the Qt stylesheet, 
which works but the padding is to the right of the vertical scroll bar 
on the right hand edge. I want the scroll bar to stay on the far edge.

I tried to add padding to the left of the scroll bar instead, which 
works but then if there is no scroll bar (I'm using scroll bars only 
when needed), there's no padding and text can go very close to the edge.

I tried adding padding to the document itself via its CSS, but that 
applies to the whole document and not just the viewport, so text can 
still get right up to the scroll bar.

Any ideas?


Thanks

Hamish



More information about the Interest mailing list