Details
-
Suggestion
-
Resolution: Done
-
P3: Somewhat important
-
4.7.4
-
None
-
Mac 10.6.6
-
f740895a71b6b0e7df5214cafa9c7746ca960ef7
Description
Use-case:
I have a QProcess that emits standard output to TextEdit in qml. As the QProcess runs, it appends messages to a TextEdit. As the TextEdit's text grows in size, performance degrades to the point of freezing the main thread.
Issue:
I suspect that the TextEdit recalculates its size when qml assigns new text to it. This size calculation performance degrades linearly as text length increases (which is expected.) TextEdits have no way to efficiently append/insert text into TextEdit programmatically. See example below:
Rectangle { width: 360 height: 600 TextEdit { id: textId anchors.fill: parent function addText(newText) { text += newText; text += "\n"; } //Handle signals from QProcess or something that's emitting lots of text signals Connections { target: talker onTalk: { textId.addText(newText); } } } }
Users can easily append or insert text at the cursor position, without performance issues.
Possible resolution:
Add functions into TextEdit to insert/append text at position in the TextEdit's document. QWidget programmers can easily do this using QPlainTextEdit::appendPlainText().
Attached is a example program showing the issue.