Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > c5a68a1bfbb41dd7ab32131d8bbca747 > files > 3294

qt4-doc-4.3.4-6mdv2008.1.x86_64.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /tmp/qt-4.3.4-qt-1203442408707/qt-x11-opensource-src-4.3.4/src/gui/text/qsyntaxhighlighter.cpp -->
<head>
  <title>Qt 4.3: QSyntaxHighlighter Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QSyntaxHighlighter Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1>
<p>The QSyntaxHighlighter class allows you to define syntax highlighting rules, and in addition you can use the class to query a document's current formatting or user data. <a href="#details">More...</a></p>
<pre> #include &lt;QSyntaxHighlighter&gt;</pre><p>Inherits <a href="qobject.html">QObject</a>.</p>
<p>This class was introduced in Qt 4.1.</p>
<ul>
<li><a href="qsyntaxhighlighter-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qsyntaxhighlighter.html#QSyntaxHighlighter">QSyntaxHighlighter</a></b> ( QObject * <i>parent</i> )</li>
<li><div class="fn"/><b><a href="qsyntaxhighlighter.html#QSyntaxHighlighter-2">QSyntaxHighlighter</a></b> ( QTextDocument * <i>parent</i> )</li>
<li><div class="fn"/><b><a href="qsyntaxhighlighter.html#QSyntaxHighlighter-3">QSyntaxHighlighter</a></b> ( QTextEdit * <i>parent</i> )</li>
<li><div class="fn"/>virtual <b><a href="qsyntaxhighlighter.html#dtor.QSyntaxHighlighter">~QSyntaxHighlighter</a></b> ()</li>
<li><div class="fn"/>QTextDocument * <b><a href="qsyntaxhighlighter.html#document">document</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qsyntaxhighlighter.html#setDocument">setDocument</a></b> ( QTextDocument * <i>doc</i> )</li>
</ul>
<ul>
<li><div class="fn"/>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<a name="public-slots"></a>
<h3>Public Slots</h3>
<ul>
<li><div class="fn"/>void <b><a href="qsyntaxhighlighter.html#rehighlight">rehighlight</a></b> ()</li>
</ul>
<ul>
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<a name="protected-functions"></a>
<h3>Protected Functions</h3>
<ul>
<li><div class="fn"/>int <b><a href="qsyntaxhighlighter.html#currentBlockState">currentBlockState</a></b> () const</li>
<li><div class="fn"/>QTextBlockUserData * <b><a href="qsyntaxhighlighter.html#currentBlockUserData">currentBlockUserData</a></b> () const</li>
<li><div class="fn"/>QTextCharFormat <b><a href="qsyntaxhighlighter.html#format">format</a></b> ( int <i>position</i> ) const</li>
<li><div class="fn"/>virtual void <b><a href="qsyntaxhighlighter.html#highlightBlock">highlightBlock</a></b> ( const QString &amp; <i>text</i> ) = 0</li>
<li><div class="fn"/>int <b><a href="qsyntaxhighlighter.html#previousBlockState">previousBlockState</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qsyntaxhighlighter.html#setCurrentBlockState">setCurrentBlockState</a></b> ( int <i>newState</i> )</li>
<li><div class="fn"/>void <b><a href="qsyntaxhighlighter.html#setCurrentBlockUserData">setCurrentBlockUserData</a></b> ( QTextBlockUserData * <i>data</i> )</li>
<li><div class="fn"/>void <b><a href="qsyntaxhighlighter.html#setFormat">setFormat</a></b> ( int <i>start</i>, int <i>count</i>, const QTextCharFormat &amp; <i>format</i> )</li>
<li><div class="fn"/>void <b><a href="qsyntaxhighlighter.html#setFormat-2">setFormat</a></b> ( int <i>start</i>, int <i>count</i>, const QColor &amp; <i>color</i> )</li>
<li><div class="fn"/>void <b><a href="qsyntaxhighlighter.html#setFormat-3">setFormat</a></b> ( int <i>start</i>, int <i>count</i>, const QFont &amp; <i>font</i> )</li>
</ul>
<ul>
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li><div class="fn"/>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QSyntaxHighlighter class allows you to define syntax highlighting rules, and in addition you can use the class to query a document's current formatting or user data.</p>
<p>The QSyntaxHighlighter class is a base class for implementing <a href="qtextedit.html">QTextEdit</a> syntax highlighters. A syntax highligher automatically highlights parts of the text in a <a href="qtextedit.html">QTextEdit</a>, or more generally in a <a href="qtextdocument.html">QTextDocument</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, you must subclass QSyntaxHighlighter and reimplement <a href="qsyntaxhighlighter.html#highlightBlock">highlightBlock</a>().</p>
<p>When you create an instance of your QSyntaxHighlighter subclass, pass it the <a href="qtextedit.html">QTextEdit</a> or <a href="qtextdocument.html">QTextDocument</a> that you want the syntax highlighting to be applied to. For example:</p>
<pre> QTextEdit *editor = new QTextEdit;
 MyHighlighter *highlighter = new MyHighlighter(editor-&gt;document());</pre>
<p>After this your <a href="qsyntaxhighlighter.html#highlightBlock">highlightBlock</a>() function will be called automatically whenever necessary. Use your <a href="qsyntaxhighlighter.html#highlightBlock">highlightBlock</a>() function to apply formatting (e.g&#x2e; setting the font and color) to the text that is passed to it. QSyntaxHighlighter provides the <a href="qsyntaxhighlighter.html#setFormat">setFormat</a>() function which applies a given <a href="qtextcharformat.html">QTextCharFormat</a> on the current text block. For example:</p>
<pre> void MyHighlighter::highlightBlock(const QString &amp;text)
 {
     QTextCharFormat myClassFormat;
     myClassFormat.setFontWeight(QFont::Bold);
     myClassFormat.setForeground(Qt::darkMagenta);
     QString pattern = &quot;\\bMy[A-Za-z]+\\b&quot;;

     QRegExp expression(pattern);
     int index = text.indexOf(expression);
     while (index &gt;= 0) {
         int length = expression.matchedLength();
         setFormat(index, length, myClassFormat);
         index = text.indexOf(expression, index + length);
      }
  }</pre>
<p>Some syntaxes can have constructs that span several text blocks. For example, a C++ syntax highlighter should be able to cope with <tt>/</tt><tt>*...*</tt><tt>/</tt> multiline comments. To deal with these cases it is necessary to know the end state of the previous text block (e.g&#x2e; &quot;in comment&quot;).</p>
<p>Inside your <a href="qsyntaxhighlighter.html#highlightBlock">highlightBlock</a>() implementation you can query the end state of the previous text block using the <a href="qsyntaxhighlighter.html#previousBlockState">previousBlockState</a>() function. After parsing the block you can save the last state using <a href="qsyntaxhighlighter.html#setCurrentBlockState">setCurrentBlockState</a>().</p>
<p>The <a href="qsyntaxhighlighter.html#currentBlockState">currentBlockState</a>() and <a href="qsyntaxhighlighter.html#previousBlockState">previousBlockState</a>() functions return an int value. If no state is set, the returned value is -1. You can designate any other value to identify any given state using the <a href="qsyntaxhighlighter.html#setCurrentBlockState">setCurrentBlockState</a>() function. Once the state is set the <a href="qtextblock.html">QTextBlock</a> keeps that value until it is set set again or until the corresponding paragraph of text is deleted.</p>
<p>For example, if you're writing a simple C++ syntax highlighter, you might designate 1 to signify &quot;in comment&quot;:</p>
<pre> QTextCharFormat multiLineCommentFormat;
 multiLineCommentFormat.setForeground(Qt::red);

 QRegExp startExpression(&quot;/\\*&quot;);
 QRegExp endExpression(&quot;\\* /&quot;);

 setCurrentBlockState(0);

 int startIndex = 0;
 if (previousBlockState() != 1)
     startIndex = text.indexOf(startExpression);

 while (startIndex &gt;= 0) {
    int endIndex = text.indexOf(endExpression, startIndex);
    int commentLength;
    if (endIndex == -1) {
        setCurrentBlockState(1);
        commentLength = text.length() - startIndex;
    } else {
        commentLength = endIndex - startIndex
                        + endExpression.matchedLength();
    }
    setFormat(startIndex, commentLength, multiLineCommentFormat);
    startIndex = text.indexOf(startExpression,
                              startIndex + commentLength);
 }</pre>
<p>In the example above, we first set the current block state to 0. Then, if the previous block ended within a comment, we higlight from the beginning of the current block (<tt>startIndex = 0</tt>). Otherwise, we search for the given start expression. If the specified end expression cannot be found in the text block, we change the current block state by calling <a href="qsyntaxhighlighter.html#setCurrentBlockState">setCurrentBlockState</a>(), and make sure that the rest of the block is higlighted.</p>
<p>In addition you can query the current formatting and user data using the <a href="qsyntaxhighlighter.html#format">format</a>() and <a href="qsyntaxhighlighter.html#currentBlockUserData">currentBlockUserData</a>() functions respectively. You can also attach user data to the current text block using the <a href="qsyntaxhighlighter.html#setCurrentBlockUserData">setCurrentBlockUserData</a>() function. <a href="qtextblockuserdata.html">QTextBlockUserData</a> can be used to store custom settings. In the case of syntax highlighting, it is in particular interesting as cache storage for information that you may figure out while parsing the paragraph's text. For an example, see the <a href="qsyntaxhighlighter.html#setCurrentBlockUserData">setCurrentBlockUserData</a>() documentation.</p>
<p>See also <a href="qtextedit.html">QTextEdit</a> and <a href="richtext-syntaxhighlighter.html">Syntax Highlighter Example</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QSyntaxHighlighter"></a>QSyntaxHighlighter::QSyntaxHighlighter ( <a href="qobject.html">QObject</a> * <i>parent</i> )</h3>
<p>Constructs a <a href="qsyntaxhighlighter.html">QSyntaxHighlighter</a> with the given <i>parent</i>.</p>
<h3 class="fn"><a name="QSyntaxHighlighter-2"></a>QSyntaxHighlighter::QSyntaxHighlighter ( <a href="qtextdocument.html">QTextDocument</a> * <i>parent</i> )</h3>
<p>Constructs a <a href="qsyntaxhighlighter.html">QSyntaxHighlighter</a> and installs it on <i>parent</i>. The specified <a href="qtextdocument.html">QTextDocument</a> also becomes the owner of the <a href="qsyntaxhighlighter.html">QSyntaxHighlighter</a>.</p>
<h3 class="fn"><a name="QSyntaxHighlighter-3"></a>QSyntaxHighlighter::QSyntaxHighlighter ( <a href="qtextedit.html">QTextEdit</a> * <i>parent</i> )</h3>
<p>Constructs a <a href="qsyntaxhighlighter.html">QSyntaxHighlighter</a> and installs it on <i>parent</i> 's <a href="qtextdocument.html">QTextDocument</a>. The specified <a href="qtextedit.html">QTextEdit</a> also becomes the owner of the <a href="qsyntaxhighlighter.html">QSyntaxHighlighter</a>.</p>
<h3 class="fn"><a name="dtor.QSyntaxHighlighter"></a>QSyntaxHighlighter::~QSyntaxHighlighter ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Destructor. Uninstalls this syntax highlighter from the text document.</p>
<h3 class="fn"><a name="currentBlockState"></a>int QSyntaxHighlighter::currentBlockState () const&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Returns the state of the current text block. If no value is set, the returned value is -1.</p>
<p>See also <a href="qsyntaxhighlighter.html#setCurrentBlockState">setCurrentBlockState</a>().</p>
<h3 class="fn"><a name="currentBlockUserData"></a><a href="qtextblockuserdata.html">QTextBlockUserData</a> * QSyntaxHighlighter::currentBlockUserData () const&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Returns the <a href="qtextblockuserdata.html">QTextBlockUserData</a> object previously attached to the current text block.</p>
<p>See also <a href="qtextblock.html#userData">QTextBlock::userData</a>() and <a href="qsyntaxhighlighter.html#setCurrentBlockUserData">setCurrentBlockUserData</a>().</p>
<h3 class="fn"><a name="document"></a><a href="qtextdocument.html">QTextDocument</a> * QSyntaxHighlighter::document () const</h3>
<p>Returns the <a href="qtextdocument.html">QTextDocument</a> on which this syntax highlighter is installed.</p>
<p>See also <a href="qsyntaxhighlighter.html#setDocument">setDocument</a>().</p>
<h3 class="fn"><a name="format"></a><a href="qtextcharformat.html">QTextCharFormat</a> QSyntaxHighlighter::format ( int <i>position</i> ) const&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Returns the format at <i>position</i> inside the syntax highlighter's current text block.</p>
<p>See also <a href="qsyntaxhighlighter.html#setFormat">setFormat</a>().</p>
<h3 class="fn"><a name="highlightBlock"></a>void QSyntaxHighlighter::highlightBlock ( const <a href="qstring.html">QString</a> &amp; <i>text</i> )&nbsp;&nbsp;<tt> [pure virtual protected]</tt></h3>
<p>Highlights the given text block. This function is called when necessary by the rich text engine, i.e&#x2e; on text blocks which have changed.</p>
<p>To provide your own syntax highlighting, you must subclass <a href="qsyntaxhighlighter.html">QSyntaxHighlighter</a> and reimplement highlightBlock(). In your reimplementation you should parse the block's <i>text</i> and call <a href="qsyntaxhighlighter.html#setFormat">setFormat</a>() as often as necessary to apply any font and color changes that you require. For example:</p>
<pre> void MyHighlighter::highlightBlock(const QString &amp;text)
 {
     QTextCharFormat myClassFormat;
     myClassFormat.setFontWeight(QFont::Bold);
     myClassFormat.setForeground(Qt::darkMagenta);
     QString pattern = &quot;\\bMy[A-Za-z]+\\b&quot;;

     QRegExp expression(pattern);
     int index = text.indexOf(expression);
     while (index &gt;= 0) {
         int length = expression.matchedLength();
         setFormat(index, length, myClassFormat);
         index = text.indexOf(expression, index + length);
      }
  }</pre>
<p>Some syntaxes can have constructs that span several text blocks. For example, a C++ syntax highlighter should be able to cope with <tt>/</tt><tt>*...*</tt><tt>/</tt> multiline comments. To deal with these cases it is necessary to know the end state of the previous text block (e.g&#x2e; &quot;in comment&quot;).</p>
<p>Inside your highlightBlock() implementation you can query the end state of the previous text block using the <a href="qsyntaxhighlighter.html#previousBlockState">previousBlockState</a>() function. After parsing the block you can save the last state using <a href="qsyntaxhighlighter.html#setCurrentBlockState">setCurrentBlockState</a>().</p>
<p>The <a href="qsyntaxhighlighter.html#currentBlockState">currentBlockState</a>() and <a href="qsyntaxhighlighter.html#previousBlockState">previousBlockState</a>() functions return an int value. If no state is set, the returned value is -1. You can designate any other value to identify any given state using the <a href="qsyntaxhighlighter.html#setCurrentBlockState">setCurrentBlockState</a>() function. Once the state is set the <a href="qtextblock.html">QTextBlock</a> keeps that value until it is set set again or until the corresponding paragraph of text gets deleted.</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 text block that ended in the middle of a comment you'd set 1 using setCurrentBlockState, and for other paragraphs you'd set 0. In your parsing code if the return value of <a href="qsyntaxhighlighter.html#previousBlockState">previousBlockState</a>() is 1, you would highlight the text as a C++ comment until you reached the closing <tt>*</tt><tt>/</tt>.</p>
<p>See also <a href="qsyntaxhighlighter.html#previousBlockState">previousBlockState</a>(), <a href="qsyntaxhighlighter.html#setFormat">setFormat</a>(), and <a href="qsyntaxhighlighter.html#setCurrentBlockState">setCurrentBlockState</a>().</p>
<h3 class="fn"><a name="previousBlockState"></a>int QSyntaxHighlighter::previousBlockState () const&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Returns the end state of the text block previous to the syntax highlighter's current block. If no value was previously set, the returned value is -1.</p>
<p>See also <a href="qsyntaxhighlighter.html#highlightBlock">highlightBlock</a>() and <a href="qsyntaxhighlighter.html#setCurrentBlockState">setCurrentBlockState</a>().</p>
<h3 class="fn"><a name="rehighlight"></a>void QSyntaxHighlighter::rehighlight ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>Redoes the highlighting of the whole document.</p>
<p>This function was introduced in Qt 4.2.</p>
<h3 class="fn"><a name="setCurrentBlockState"></a>void QSyntaxHighlighter::setCurrentBlockState ( int <i>newState</i> )&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Sets the state of the current text block to <i>newState</i>.</p>
<p>See also <a href="qsyntaxhighlighter.html#currentBlockState">currentBlockState</a>() and <a href="qsyntaxhighlighter.html#highlightBlock">highlightBlock</a>().</p>
<h3 class="fn"><a name="setCurrentBlockUserData"></a>void QSyntaxHighlighter::setCurrentBlockUserData ( <a href="qtextblockuserdata.html">QTextBlockUserData</a> * <i>data</i> )&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Attaches the given <i>data</i> to the current text block. The ownership is passed to the underlying text document, i.e&#x2e; the provided <a href="qtextblockuserdata.html">QTextBlockUserData</a> object will be deleted if the corresponding text block gets deleted.</p>
<p><a href="qtextblockuserdata.html">QTextBlockUserData</a> can be used to store custom settings. In the case of syntax highlighting, it is in particular interesting as cache storage for information that you may figure out while parsing the paragraph's text.</p>
<p>For example while parsing the text, you can keep track of parenthesis characters that you encounter ('{[(' and the like), and store their relative position and the actual <a href="qchar.html">QChar</a> in a simple class derived from <a href="qtextblockuserdata.html">QTextBlockUserData</a>:</p>
<pre> struct ParenthesisInfo
 {
     QChar char;
     int position;
 };

 struct BlockData : public QTextBlockUserData
 {
     QVector&lt;ParenthesisInfo&gt; parentheses;
 };</pre>
<p>During cursor navigation in the associated editor, you can ask the current <a href="qtextblock.html">QTextBlock</a> (retrieved using the <a href="qtextcursor.html#block">QTextCursor::block</a>() function) if it has a user data object set and cast it to your <tt>BlockData</tt> object. Then you can check if the current cursor position matches with a previously recorded parenthesis position, and, depending on the type of parenthesis (opening or closing), find the next opening or closing parenthesis on the same level.</p>
<p>In this way you can do a visual parenthesis matching and highlight from the current cursor position to the matching parenthesis. That makes it easier to spot a missing parenthesis in your code and to find where a corresponding opening/closing parenthesis is when editing parenthesis intensive code.</p>
<p>See also <a href="qsyntaxhighlighter.html#currentBlockUserData">currentBlockUserData</a>() and <a href="qtextblock.html#setUserData">QTextBlock::setUserData</a>().</p>
<h3 class="fn"><a name="setDocument"></a>void QSyntaxHighlighter::setDocument ( <a href="qtextdocument.html">QTextDocument</a> * <i>doc</i> )</h3>
<p>Installs the syntax highlighter on the given <a href="qtextdocument.html">QTextDocument</a> <i>doc</i>. A <a href="qsyntaxhighlighter.html">QSyntaxHighlighter</a> can only be used with one document at a time.</p>
<p>See also <a href="qsyntaxhighlighter.html#document">document</a>().</p>
<h3 class="fn"><a name="setFormat"></a>void QSyntaxHighlighter::setFormat ( int <i>start</i>, int <i>count</i>, const <a href="qtextcharformat.html">QTextCharFormat</a> &amp; <i>format</i> )&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>This function is applied to the syntax highlighter's current text block (i.e&#x2e; the text that is passed to the <a href="qsyntaxhighlighter.html#highlightBlock">highlightBlock</a>() function).</p>
<p>The specified <i>format</i> is applied to the text from the <i>start</i> position for a length of <i>count</i> characters (if <i>count</i> is 0, nothing is done). The formatting properties set in <i>format</i> are merged at display time with the formatting information stored directly in the document, for example as previously set with <a href="qtextcursor.html">QTextCursor</a>'s functions. Note that the document itself remains unmodified by the format set through this function.</p>
<p>See also <a href="qsyntaxhighlighter.html#format">format</a>() and <a href="qsyntaxhighlighter.html#highlightBlock">highlightBlock</a>().</p>
<h3 class="fn"><a name="setFormat-2"></a>void QSyntaxHighlighter::setFormat ( int <i>start</i>, int <i>count</i>, const <a href="qcolor.html">QColor</a> &amp; <i>color</i> )&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>The specified <i>color</i> is applied to the current text block from the <i>start</i> position for a length of <i>count</i> characters.</p>
<p>The other attributes of the current text block, e.g&#x2e; the font and background color, are reset to default values.</p>
<p>See also <a href="qsyntaxhighlighter.html#format">format</a>() and <a href="qsyntaxhighlighter.html#highlightBlock">highlightBlock</a>().</p>
<h3 class="fn"><a name="setFormat-3"></a>void QSyntaxHighlighter::setFormat ( int <i>start</i>, int <i>count</i>, const <a href="qfont.html">QFont</a> &amp; <i>font</i> )&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>The specified <i>font</i> is applied to the current text block from the <i>start</i> position for a length of <i>count</i> characters.</p>
<p>The other attributes of the current text block, e.g&#x2e; the font and background color, are reset to default values.</p>
<p>See also <a href="qsyntaxhighlighter.html#format">format</a>() and <a href="qsyntaxhighlighter.html#highlightBlock">highlightBlock</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.4</div></td>
</tr></table></div></address></body>
</html>