title: Qt: How to adjust the size of a QTextEdit object automatically
body: <p>How can I automatically adjust the size of a QTextEdit object to automatically resize itself when the text string is larger than the given geometry?</p>
  
  <p>In my example below, I define the geometry of the QTextEdit box to be 100x100.  However, the text string that I would like to display could be much larger than that.</p>
  
  <pre><code>void MainWindow::display_text()
  {
      QTextEdit *text = new QTextEdit(this);
      text-&gt;setWordWrapMode(QTextOption::NoWrap);
      text-&gt;setFontPointSize(24);
  
      /* Set the text box to be 100x100 */
      text-&gt;setGeometry(1, 1, 100, 100);
  
      /* The destination field may be too large to fit in the text box */
      QString arg = QString("Destination: %1").arg(destination);
      text-&gt;append(arg);
  
      text-&gt;show();
  }
  </code></pre>
  
  <p>I would like the text string to be visible (ie no scrolling) and word-wrapping is turned off.</p>