[Interest] Insert without scrolling

Tony Rietwyk tony at rightsoft.com.au
Thu Apr 10 03:05:36 CEST 2014


Hi Hugo, 

Try using an explicit QTextCursor rather than the QTextEdit interfaces. 

Hope that helps, 

Tony


> -----Original Message-----
> Sent: Thursday, 10 April 2014 2:23 AM
> 
> Hi,
> 
> I am trying to insert some text at the top of a QPlainTextEdit. To do so
I'm am
> using this lines of code:
> 
> ui->textEdit->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
> ui->textEdit->insertPlainText("Some text here");
> 
> The problem is that, by doing this, the textEdit is scrolled to the top in
order
> to show the new inserted text.
> 
> Is there any way to avoid this scrolling to the top? I need to insert this
text
> silently without the user noticing.
> 
> Thanks for your help,





More information about the Interest mailing list