title: Trying to clear a textEdit box in QT C++ (using QT Creator)
body: <p>I'm new to QT, young at programming, and not understanding all the help materials for the classes in QT.</p>
  
  <p>I have the following code, which executes on a button click, inserting text. This works fine but I want to clear the textEdit first, then insert the new text. Can anyone point me in the right direction here? Any help is much appreciated.</p>
  
  <pre><code>QTextCharFormat textFormat;
  QTextCursor cursor(ui-&gt;textEdit-&gt;textCursor());
  cursor.insertText("&lt;some text to insert", textFormat);
  </code></pre>
  
  <p>It appears that I have to use setPosition() and movePosition() to select the text, then removeSelectedText() to clear it. I don't know how to determine the first and last positions in the document.</p>