title: How to remove this space(margin) from a QWidget form
body: <p>I have a <code>QWidget form</code>, then I have added <code>QTextEdit</code> on the form, but there is a space(margin) in the top.  </p>
  
  <p><img src="https://i.stack.imgur.com/8g8Gb.jpg" alt=""></p>
  
  <p>I tried to use the following:</p>
  
  <pre><code>QWidget *widget = new QWidget(this);
  widget-&gt;layout()-&gt;setContentsMargins(0,0,0,0);
  </code></pre>
  
  <p>But unfortunately, it did not do what I want.  </p>
  
  <p>How to remove that space(margin) to be like the <code>left</code>, <code>right</code> and <code>down</code> side ? </p>
  
  <hr>
  
  <p><strong>Full code</strong></p>
  
  <pre><code>QWidget *widget = new QWidget(this);
  QTextEdit *TextEdit = new QTextEdit(widget);
  QMdiSubWindow *mdiWindows = ui-&gt;mdiArea-&gt;addSubWindow(widget);
  mdiWindows-&gt;setGeometry(5, 5, 300, 250);
  mdiWindows-&gt;setWindowTitle(finfo.baseName());
  mdiWindows-&gt;setWindowState(Qt::WindowMaximized);
  mdiWindows-&gt;layout()-&gt;addWidget(TextEdit);
  mdiWindows-&gt;layout()-&gt;setContentsMargins(0,0,0,0);
  TextEdit-&gt;setText(cache);
  widget-&gt;setMaximumHeight(0);
  mdiWindows-&gt;show();
  </code></pre>