Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > ff187cb994c94c614ecc64c5a8528b1b > files > 4692

qt-doc-4.8.5-10.fc18.noarch.rpm

<?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" />
<!-- q3syntaxhighlighter.cpp -->
  <title>Qt 4.8: Q3SyntaxHighlighter Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li>Qt3SupportLight</li>
<li>Q3SyntaxHighlighter</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">Q3SyntaxHighlighter Class Reference</h1>
<!-- $$$Q3SyntaxHighlighter-brief -->
<p>The Q3SyntaxHighlighter class is a base class for implementing <a href="q3textedit.html">Q3TextEdit</a> syntax highlighters. <a href="#details">More...</a></p>
<!-- @@@Q3SyntaxHighlighter -->
<pre class="cpp"> <span class="preprocessor">#include &lt;Q3SyntaxHighlighter&gt;</span></pre><p><b>This class is part of the Qt 3 support library.</b> It is provided to keep old source code working. We strongly advise against using it in new code. See <a href="porting4.html#qsyntaxhighlighter">Porting to Qt 4</a> for more information.</p>
<ul>
<li><a href="q3syntaxhighlighter-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3syntaxhighlighter.html#Q3SyntaxHighlighter">Q3SyntaxHighlighter</a></b> ( Q3TextEdit * <i>textEdit</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="q3syntaxhighlighter.html#dtor.Q3SyntaxHighlighter">~Q3SyntaxHighlighter</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3syntaxhighlighter.html#currentParagraph">currentParagraph</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="q3syntaxhighlighter.html#highlightParagraph">highlightParagraph</a></b> ( const QString &amp; <i>text</i>, int <i>endStateOfLastPara</i> ) = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3syntaxhighlighter.html#rehighlight">rehighlight</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3syntaxhighlighter.html#setFormat">setFormat</a></b> ( int <i>start</i>, int <i>count</i>, const QFont &amp; <i>font</i>, const QColor &amp; <i>color</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3syntaxhighlighter.html#setFormat-2">setFormat</a></b> ( int <i>start</i>, int <i>count</i>, const QColor &amp; <i>color</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3syntaxhighlighter.html#setFormat-3">setFormat</a></b> ( int <i>start</i>, int <i>count</i>, const QFont &amp; <i>font</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q3TextEdit * </td><td class="memItemRight bottomAlign"><b><a href="q3syntaxhighlighter.html#textEdit">textEdit</a></b> () const</td></tr>
</table>
<a name="details"></a>
<!-- $$$Q3SyntaxHighlighter-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The Q3SyntaxHighlighter class is a base class for implementing <a href="q3textedit.html">Q3TextEdit</a> syntax highlighters.</p>
<p>A syntax highligher automatically highlights parts of the text in a <a href="q3textedit.html">Q3TextEdit</a>. Syntax highlighters are often used when the user is entering text in a specific format (for example, source code) and help the user to read the text and identify syntax errors.</p>
<p>To provide your own syntax highlighting for <a href="q3textedit.html">Q3TextEdit</a>, you must subclass Q3SyntaxHighlighter and reimplement <a href="q3syntaxhighlighter.html#highlightParagraph">highlightParagraph</a>().</p>
<p>When you create an instance of your Q3SyntaxHighlighter subclass, pass it the <a href="q3textedit.html">Q3TextEdit</a> that you want the syntax highlighting to be applied to. After this your <a href="q3syntaxhighlighter.html#highlightParagraph">highlightParagraph</a>() function will be called automatically whenever necessary. Use your <a href="q3syntaxhighlighter.html#highlightParagraph">highlightParagraph</a>() function to apply formatting (e.g&#x2e; setting the font and color) to the text that is passed to it.</p>
</div>
<!-- @@@Q3SyntaxHighlighter -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$Q3SyntaxHighlighter[overload1]$$$Q3SyntaxHighlighterQ3TextEdit* -->
<h3 class="fn"><a name="Q3SyntaxHighlighter"></a>Q3SyntaxHighlighter::<span class="name">Q3SyntaxHighlighter</span> ( <span class="type"><a href="q3textedit.html">Q3TextEdit</a></span> * <i>textEdit</i> )</h3>
<p>Constructs the <a href="q3syntaxhighlighter.html" class="compat">Q3SyntaxHighlighter</a> and installs it on <i>textEdit</i>. Ownership of the <a href="q3syntaxhighlighter.html" class="compat">Q3SyntaxHighlighter</a> is transferred to the <i>textEdit</i></p>
<!-- @@@Q3SyntaxHighlighter -->
<!-- $$$~Q3SyntaxHighlighter[overload1]$$$~Q3SyntaxHighlighter -->
<h3 class="fn"><a name="dtor.Q3SyntaxHighlighter"></a>Q3SyntaxHighlighter::<span class="name">~Q3SyntaxHighlighter</span> ()<tt> [virtual]</tt></h3>
<p>Destructor. Uninstalls this syntax highlighter from the <a href="q3syntaxhighlighter.html#textEdit">textEdit</a>()</p>
<!-- @@@~Q3SyntaxHighlighter -->
<!-- $$$currentParagraph[overload1]$$$currentParagraph -->
<h3 class="fn"><a name="currentParagraph"></a><span class="type">int</span> Q3SyntaxHighlighter::<span class="name">currentParagraph</span> () const</h3>
<p>Returns the id of the paragraph which is highlighted, or -1 of no paragraph is currently highlighted.</p>
<p>Usually this function is called from within <a href="q3syntaxhighlighter.html#highlightParagraph">highlightParagraph</a>().</p>
<!-- @@@currentParagraph -->
<!-- $$$highlightParagraph[overload1]$$$highlightParagraphconstQString&int -->
<h3 class="fn"><a name="highlightParagraph"></a><span class="type">int</span> Q3SyntaxHighlighter::<span class="name">highlightParagraph</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>text</i>, <span class="type">int</span> <i>endStateOfLastPara</i> )<tt> [pure virtual]</tt></h3>
<p>This function is called when necessary by the rich text engine, i.e&#x2e; on paragraphs which have changed.</p>
<p>In your reimplementation you should parse the paragraph's <i>text</i> and call <a href="q3syntaxhighlighter.html#setFormat">setFormat</a>() as often as necessary to apply any font and color changes that you require. Your function must return a value which indicates the paragraph's end state: see below.</p>
<p>Some syntaxes can have constructs that span paragraphs. For example, a C++ syntax highlighter should be able to cope with <tt>/</tt><tt>*..&#x2e;*</tt><tt>/</tt> comments that span paragraphs. To deal with these cases it is necessary to know the end state of the previous paragraph (e.g&#x2e; &quot;in comment&quot;).</p>
<p>If your syntax does not have paragraph spanning constructs, simply ignore the <i>endStateOfLastPara</i> parameter and always return 0.</p>
<p>Whenever highlightParagraph() is called it is passed a value for <i>endStateOfLastPara</i>. For the very first paragraph this value is always -2. For any other paragraph the value is the value returned by the most recent highlightParagraph() call that applied to the preceding paragraph.</p>
<p>The value you return is up to you. We recommend only returning 0 (to signify that this paragraph's syntax highlighting does not affect the following paragraph), or a positive integer (to signify that this paragraph has ended in the middle of a paragraph spanning construct).</p>
<p>To find out which paragraph is highlighted, call <a href="q3syntaxhighlighter.html#currentParagraph">currentParagraph</a>().</p>
<p>For example, if you're writing a simple C++ syntax highlighter, you might designate 1 to signify &quot;in comment&quot;. For a paragraph that ended in the middle of a comment you'd return 1, and for other paragraphs you'd return 0. In your parsing code if <i>endStateOfLastPara</i> was 1, you would highlight the text as a C++ comment until you reached the closing <tt>*</tt><tt>/</tt>.</p>
<!-- @@@highlightParagraph -->
<!-- $$$rehighlight[overload1]$$$rehighlight -->
<h3 class="fn"><a name="rehighlight"></a><span class="type">void</span> Q3SyntaxHighlighter::<span class="name">rehighlight</span> ()</h3>
<p>Redoes the highlighting of the whole document.</p>
<!-- @@@rehighlight -->
<!-- $$$setFormat[overload1]$$$setFormatintintconstQFont&constQColor& -->
<h3 class="fn"><a name="setFormat"></a><span class="type">void</span> Q3SyntaxHighlighter::<span class="name">setFormat</span> ( <span class="type">int</span> <i>start</i>, <span class="type">int</span> <i>count</i>, const <span class="type"><a href="qfont.html">QFont</a></span> &amp; <i>font</i>, const <span class="type"><a href="qcolor.html">QColor</a></span> &amp; <i>color</i> )</h3>
<p>This function is applied to the syntax highlighter's current paragraph (the text of which is passed to the <a href="q3syntaxhighlighter.html#highlightParagraph">highlightParagraph</a>() function).</p>
<p>The specified <i>font</i> and <i>color</i> are applied to the text from position <i>start</i> for <i>count</i> characters. (If <i>count</i> is 0, nothing is done.)</p>
<!-- @@@setFormat -->
<!-- $$$setFormat$$$setFormatintintconstQColor& -->
<h3 class="fn"><a name="setFormat-2"></a><span class="type">void</span> Q3SyntaxHighlighter::<span class="name">setFormat</span> ( <span class="type">int</span> <i>start</i>, <span class="type">int</span> <i>count</i>, const <span class="type"><a href="qcolor.html">QColor</a></span> &amp; <i>color</i> )</h3>
<p>This is an overloaded function.</p>
<!-- @@@setFormat -->
<!-- $$$setFormat$$$setFormatintintconstQFont& -->
<h3 class="fn"><a name="setFormat-3"></a><span class="type">void</span> Q3SyntaxHighlighter::<span class="name">setFormat</span> ( <span class="type">int</span> <i>start</i>, <span class="type">int</span> <i>count</i>, const <span class="type"><a href="qfont.html">QFont</a></span> &amp; <i>font</i> )</h3>
<p>This is an overloaded function.</p>
<!-- @@@setFormat -->
<!-- $$$textEdit[overload1]$$$textEdit -->
<h3 class="fn"><a name="textEdit"></a><span class="type"><a href="q3textedit.html">Q3TextEdit</a></span> * Q3SyntaxHighlighter::<span class="name">textEdit</span> () const</h3>
<p>Returns the <a href="q3textedit.html" class="compat">Q3TextEdit</a> on which this syntax highlighter is installed</p>
<!-- @@@textEdit -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2013 Digia Plc 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>
      Digia, Qt and their respective logos are trademarks of Digia Plc 
      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>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>