If you want to use fields only for your QTextEdit, and not for any other element in QVerticalLayout, you can use QT stylesheets for this. You just need to specify a name for the QTextEdit object (for example, "myMarginsTextEdit") and create it, for example:
QTextEdit#myMarginsTextEdit
{
margin-left: 40px;
margin-right: 40px;
}
If you do not use QT table styles to style your application, you can still use it only to style this element. You can do it like this (imagine your QTextEdit variable is called "textEditItem"):
textEditItem.setStyleSheet("QTextEdit {margin-left:40px; margin-right:40px}");
Another option is to use content fields in a vertical layout, but then it applies to all elements.
source
share