react-nodegui icon indicating copy to clipboard operation
react-nodegui copied to clipboard

How to handle auto scroll on control QPlainTextEdit

Open leovo2708 opened this issue 5 years ago • 4 comments

I append text to the control QPlainTextEdit after interval, please help me how to scroll to the bottom,

I can't find any APIs: https://docs.nodegui.org/docs/api/generated/classes/qplaintextedit

Thanks

leovo2708 avatar Dec 30 '19 04:12 leovo2708

Hi @leovo2708 I couldnt understand what you meant here. Could you post the code snippet ?

Also, it would be awesome if you can open the issue as per the issue template.

a7ul avatar Dec 30 '19 05:12 a7ul

@master-atul I want after appending text to this control and scrollbar appears, I want to scroll to bottom by programming. Thanks.

leovo2708 avatar Dec 30 '19 06:12 leovo2708

I'm having the same issue. I don't know how to hold the scroll bar in the bottom like an installer wizard.

Duxy1996 avatar May 06 '20 11:05 Duxy1996

NodeGUI version: "@nodegui/nodegui": 0.36.0

I have the same issue with QTextEdit.

Here is some code:

const showLog = new QTextEdit();
showLog.setReadOnly(true);
showLog.setProperty('textInteractionFlags', 1);
showLog.setInlineStyle('flex: 2;');

**in a loop:**
showLog.setText(showLog.text() + "1234<br>");
const position = new QCursor();
position.pos(0, 9999999);
showLog.setCursor(position);

I tried to set the scrollbar position by setting setCursor(), to scroll to the end of Qtextedit, but without success. i made a new QCursor and changed its pos y=9999999 - to a high value - in hope that it will scroll to the end of the Qtextedit while its adding text with newlines to the textedit.

Any ideas? It maybe that while the Qtextedit is readonly it cant set cursor or scrollbar.. OR maybe i have to change the text adding in reverse direction like adding to the top of every line.

I read here about this issue: https://www.qtcentre.org/threads/5983-QTextEdit-auto-scroll

Is there a way to have it scroll down to the bottom of the page always when data is being inserted?

poky1084 avatar Dec 21 '21 12:12 poky1084