1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
  
     | 
    
      <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- richtext.qdoc -->
  <title>Qt 4.8: Advanced Rich Text Processing</title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="content"> 
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
  </div>
  <div class="breadcrumb toolblock">
    <ul>
      <li class="first"><a href="index.html">Home</a></li>
      <!--  Breadcrumbs go here -->
<li>Advanced Rich Text Processing</li>
    </ul>
  </div>
</div>
<div class="content mainContent">
  <link rel="prev" href="richtext-common-tasks.html" />
  <link rel="next" href="richtext-html-subset.html" />
<p class="naviNextPrevious headerNavi">
<a class="prevPage" href="richtext-common-tasks.html">Common Rich Text Editing Tasks</a>
<a class="nextPage" href="richtext-html-subset.html">Supported HTML Subset</a>
</p><p/>
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#handling-large-files">Handling Large Files</a></li>
</ul>
</div>
<h1 class="title">Advanced Rich Text Processing</h1>
<span class="subtitle"></span>
<!-- $$$richtext-advanced-processing.html-description -->
<div class="descr"> <a name="details"></a>
<a name="handling-large-files"></a>
<h2>Handling Large Files</h2>
<p>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.</p>
<p>If you are faced with this problem, we recommend that you address the following issues:</p>
<ul>
<li>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 <a href="qtextedit.html">QTextEdit</a>.</li>
<li>You can reduce the amount of blocks in a <a href="qtextdocument.html">QTextDocument</a> with <a href="qtextdocument.html#maximumBlockCount-prop">maximumBlockCount()</a>. The document is only as large as the number of blocks as far as <a href="qtextedit.html">QTextEdit</a> is concerned.</li>
<li>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.</li>
</ul>
<p>We give an example of the latter technique from the list. We assume that the text edit is visible.</p>
<pre class="cpp"> textEdit<span class="operator">.</span>show();
 textCursor<span class="operator">.</span>beginEditBlock();
 <span class="keyword">for</span> (<span class="type">int</span> i <span class="operator">=</span> <span class="number">0</span>; i <span class="operator"><</span> <span class="number">1000</span>; <span class="operator">+</span><span class="operator">+</span>i) {
     textCursor<span class="operator">.</span>insertBlock();
     textCursor<span class="operator">.</span>insertText(paragraphText<span class="operator">.</span>at(i));
 }
 textCursor<span class="operator">.</span>endEditBlock();</pre>
</div>
<!-- @@@richtext-advanced-processing.html -->
<p class="naviNextPrevious footerNavi">
<a class="prevPage" href="richtext-common-tasks.html">Common Rich Text Editing Tasks</a>
<a class="nextPage" href="richtext-html-subset.html">Supported HTML Subset</a>
</p>
  <div class="ft">
    <span></span>
  </div>
</div> 
<div class="footer">
    <p>
      <acronym title="Copyright">©</acronym> 2012 Nokia Corporation and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Nokia, Qt and their respective logos are trademarks of Nokia Corporation 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>
 
     |