Yes, I place QTextEdit in QVBoxLayout:
Qt Code:
  1. TestApp::TestApp()
  2. {
  3. textEdit = new QTextEdit;
  4.  
  5. layoutMain = new QVBoxLayout;
  6. layoutMain->addWidget(textEdit);
  7. layoutMain->setMargin(0);
  8.  
  9. window = new QWidget;
  10. window->setLayout(layoutMain);
  11. setCentralWidget(window);
  12. }
To copy to clipboard, switch view to plain text mode 
I tried using setContentsMargins in both textEdit and layoutMain, but it doesn't set margins at all or it works like in on picture 1.
I don't know if you understood me correctly, I would like custom margins inside the textEdit, not the layoutMain margins.