Qt:Документация 4.3.2/richtext-advanced-processing

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь



Главная · Все классы · Основные классы · Классы по группам · Модули · Функции


[Previous: Common Rich Text Editing Tasks ] [ Contents ] [Next: Supported HTML Subset ]

[править] Advanced Rich Text Processing

[править] Handling Large Files

Qt does not limit the size of files that are used for text processing. In most cases, this will not present a problem. For especially large files, however, you might experience that your application will become unresponsive or that you will run out of memory. The size of the files you can load depends on your hardware and on Qt's and your own application's implementation.

If you are faced with this problem, we recommend that you address the following issues:

  • You should consider breaking up large paragraphs into smaller ones as Qt handles small paragraphs better. You could also insert line breaks at regular intervals, which will look the same as one large paragraph in a QTextEdit.
  • You can reduce the amount of blocks in a QTextDocument with maximumBlockCount(). The document is only as large as the number of blocks as far as QTextEdit is concerned.
  • When adding text to a text edit, it is an advantage to add it in an edit block (see example below). The result is that the text edit does not need to build the entire document structure at once.

We give an example of the latter technique in the list. We assume that the text edit is visible.

 for (int i = 0; i < 1000; ++i) {

[Previous: Common Rich Text Editing Tasks ] [ Contents ] [Next: Supported HTML Subset ]

Copyright © 2007 Trolltech Trademarks
Qt 4.3.2