Solved Qt Designer, QTextEdit, remove indentation
-
Hi, in Qt Designer i add a QTextEdit and a QLabel widget. The default seems to be a border?/margin?/padding?/indentation? of 4px. I'm not sure what the extra space is but the label has an option to change the indentation which can remove the extra space on all four sides.
But the textedit does not have this option as far as i know. I want the textedit to have zero 'border space'. The stylesheet sort of gives me what i want if i change the margin or padding to -4px. But that still leaves unwanted space on the right and bottom.Is there an easy solution for this? Thanks.
-
Hi
You mean you have them in layout and there is margin ?
Layout have default margins, you can set to zero. -
I'm sorry, i should have been more clear.
The margin is within the QTextEdit itself. Space between text and frame border. -
Hi
I think its
setViewportMargins(0, 0, 0, 0);(incorrect) and also zero as default.
but i didnt test.its protected function.
-
Thanks for the suggestion. Doesn't work though. It's at 0,0,0,0 margin to begin with and it doesn't change if i set it again. Only if i set left and top to -4 does it 'fix' it.
Somehow somewhere it adds those 4 or 5 pixels on all sides of the text content.
-
try:
textEdit->document()->setDocumentMargin(0);
-
@mpergand said in Qt Designer, QTextEdit, remove indentation:
try:
textEdit->document()->setDocumentMargin(0);
Yes! This works!
Thank you! -