PDA

View Full Version : Can not clear paragraph in QTextEdit



December
26th December 2009, 05:57
I'm using a QTextEdit for user input. For some reason I can't clear it properly, I always end up with a blank paragraph (the cursor is on the 2nd line).. I've tried every way I can think off, and nothing seems to work:



inputEdit->clear();




inputEdit->setHtml( "" );




inputEdit->setPlainText( "" );




QTextCursor cursor( inputEdit->document() );
cursor.select( QTextCursor::Document );
cursor.removeSelectedText();
cursor.clearSelection();
cursor.movePosition( QTextCursor::Start );
inputEdit->setTextCursor( cursor );


None of these seem to actually clear the text edit completely, using editInput->toHtml() always shows a HTML document with a blank paragraph in it.. what am I doing wrong here?

Thanks.