PDA

View Full Version : Text margin in QTextEdit



Ponnytail
13th November 2013, 20:09
I thought there was a simple way to do this but I haven't found one yet. What I want to do is to allow my QTextEdit content to use the whole area. It seems like there's a text margin of a few pixels by default and I have no idea how to remove it. The following picture displays my problem with the text margin:

9793

I couldn't find anything super useful in the help section of Qt Creator so I thought maybe setting the style sheet was a good idea but nope. If I set a margin, it only applies to the textedit itself, obviously.

9794

Padding only applies a padding to the textedit itself, at the same time giving the content a kind of margin.

9795

This isn't surprising since QTextEdit supports the box model.
I've also tried to set the content margins


textedit->setContentMargins(0,0,0,0);

without success.
So my question is, how to remove the text margin in a QTextEdit?

Thanks!