[PySide] auto scrolling QTextEdit

Frank Rueter | OHUfx frank at ohufx.com
Fri Oct 20 07:18:15 CEST 2017


I found the problem I think.
Seems like I have to setTextCursor(cursor) after insertion.
I missed the bit in the docs that said textCursor() returns a *copy* of 
the cursor object.

On 10/20/2017 05:17 PM, Frank Rueter | OHUfx wrote:
> HI guys,
>
> been really quiet in here, hopefully this channel is still used.
> Quick question:
> I am using a QTextEdit ti print output from an external process which 
> is run via QProcess.
> However, QTextEdit does nto auto-scroll  when the output fills up the 
> widget.
> Based on info I found online I put this code together in the slot that 
> feeds the stdout to my widget:
>
>         cursor = self.outputWidget.textCursor()
>         cursor.movePosition(cursor.End)
>         cursor.insertText(unicode(self.process.readAll()))
>
>         # trying to auto-scroll but tit won't work:
>         sb = self.outputWidget.verticalScrollBar()
>         sb.setValue(sb.maximum())
>         self.outputWidget.ensureCursorVisible()
>
>
> Can somebody help please?
>
> Cheers,
> frank
>
>
> -- 
> ohufxLogo 50x50 <http://www.ohufx.com> 	*vfx compositing 
> <http://ohufx.com/index.php/vfx-compositing> | *workflow customisation 
> and consulting <http://ohufx.com/index.php/vfx-customising>* *
>
>
>
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20171020/17d6187c/attachment.html>


More information about the PySide mailing list