Problems with QTextBrowser
-
Hello all!
I have these problems:
-
It doesn't scroll when I use
@ui->output->insertPlainText(output_buffer);@
I mean, even it goes below the widget, the scroll shows itself but doesn't scroll along with the text being placed inside it. -
I have checked the readOnly checkbox and yes, it doesn't take input put when I click in it it changes the cursor position and it outputs the next 'output_buffer' after where I placed the cursor and continues from there.
Thanks for any replies :)
-
-
Have a look at this "parallel thread":http://developer.qt.nokia.com/forums/viewthread/12636 dealing with the same problem.
-
Thanks! What about the 2nd problem :D ?
-
I cannot reproduce the second error on a Mac. Did you try it with a [[Doc:QTextBrowser]] already?
-
But the problem IS about a QTextBrowser (look at the title).
Well, to describe better what the problem is:
I have this code being called by a timer once a second:
@
ui->output->insertPlainText("HELLO PLAIN\n");
sb->setValue(sb->maximum());
@
And here's the screenshot which shows that I clicked inside the QTextBrowser, cursor position changed and output started being placed from there:!http://i.imgur.com/D5c9Y.png(image.png)! -
Why don't you use QTextEdit::append()?
-
Because append() seems to add automatically an additional '\n' or '\r' to the end of the string and I just want to display the data coming from my serial port "as is".
-
Then you will have to use a [[Doc:QTextCursor]] that you get from the [[Doc:QTextEdit]] or its [[Doc:QTextDocument]], move the cursor position to the end and insert there.
BTW: you might be better off using a [[Doc:QPlainTextEdit]] instead of the rich text editor.
-
Thanks a lot! Both problems have been solved :)