Search code examples
performanceqtqtexteditqlabel

QLabel vs QTextEdit, to show long text. Which is faster?


I used QTextEdit in read-only mode (I want to make it become Label) to show a long text, but I wonder that when doing like this, how is our performance? Will QTextEdit be faster than QLabel or not? Is there any better ways to show a long text and to get a good performance? Please help me answer these questions.


Solution

  • In case you don't have rich text and want to only show plain text, it's better to use QPlainTextEdit which is exactly for showing large texts. It uses most of the features of QTextEdit but with a vastly better performance.

    Using QPlainTextEdit is better than using QLabel for displaying large text documents as the former has many more capabilities and features for customization and formatting.