diff options
Diffstat (limited to 'doc/html/designer-manual-3.html')
-rw-r--r-- | doc/html/designer-manual-3.html | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/doc/html/designer-manual-3.html b/doc/html/designer-manual-3.html index 1cd7e09fc..553ea58cb 100644 --- a/doc/html/designer-manual-3.html +++ b/doc/html/designer-manual-3.html @@ -627,7 +627,7 @@ body { background: #ffffff; color: black; } { clearData( FALSE ); m_filename = filename; - <a href="ntqregexp.html">TQRegExp</a> regex( "^\\s*(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\S+.*)$" ); + <a href="tqregexp.html">TQRegExp</a> regex( "^\\s*(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\S+.*)$" ); <a href="ntqfile.html">TQFile</a> file( filename ); if ( file.<a href="ntqfile.html#open">open</a>( IO_ReadOnly ) ) { statusBar()->message( TQString( "Loading '%1'..." ). @@ -636,13 +636,13 @@ body { background: #ffffff; color: black; } <a href="tqstring.html">TQString</a> line; while ( ! stream.<a href="tqtextstream.html#eof">eof</a>() ) { line = stream.<a href="tqtextstream.html#readLine">readLine</a>(); - if ( regex.<a href="ntqregexp.html#search">search</a>( line ) == -1 ) + if ( regex.<a href="tqregexp.html#search">search</a>( line ) == -1 ) m_comments += line; else - m_colors[regex.<a href="ntqregexp.html#cap">cap</a>( 4 )] = TQColor( - regex.<a href="ntqregexp.html#cap">cap</a>( 1 ).toInt(), - regex.<a href="ntqregexp.html#cap">cap</a>( 2 ).toInt(), - regex.<a href="ntqregexp.html#cap">cap</a>( 3 ).toInt() ); + m_colors[regex.<a href="tqregexp.html#cap">cap</a>( 4 )] = TQColor( + regex.<a href="tqregexp.html#cap">cap</a>( 1 ).toInt(), + regex.<a href="tqregexp.html#cap">cap</a>( 2 ).toInt(), + regex.<a href="tqregexp.html#cap">cap</a>( 3 ).toInt() ); } file.<a href="ntqfile.html#close">close</a>(); m_filename = filename; @@ -674,10 +674,10 @@ RED WHITESPACE GREEN WHITESPACE BLUE WHITESPACE NAME <p>There are numerous approaches we could have taken to parsing these files, but we've opted for a simple regular expression (regex). The regex is more "liberal" regarding the whitespace in the input than the format demands.</p> <p>If a line matches the regex we create a new entry in the <tt>m_colors</tt> <a href="tqmap.html">TQMap</a>, setting its text to be the name of the color (<tt>regex.cap( 4 )</tt>), and its value to be a new <a href="ntqcolor.html">TQColor</a> created from the red, green and blue values. Lines that don't match the regex are treated as comments and are stored in the <tt>m_comments</tt> string list. (When we save the file we write all the comments out first even if they appeared in the middle of the file.)</p> <p>Once we've populated the <tt>m_colors</tt> map we mark the visible view as "dirty" and call <tt>populate()</tt> to update it. We then mark the visible view as not dirty and the non-visible view as dirty. This ensures that when user changes the view, the view they switch to will be updated. We could have simply marked both views as dirty and updated them both, but it is more efficient to update "lazily", after all the user may only ever use one view, so why waste their time updating the other one.</p> -<p>Since we're using <a href="ntqfile.html">TQFile</a> and <a href="ntqregexp.html">TQRegExp</a> we need to include the relevant headers. (Right click "Includes (in Implementation)", then click <b>New</b>. Type "ntqfile.h" and press <b>Enter</b>. Repeat this process to add "ntqregexp.h".)</p> +<p>Since we're using <a href="ntqfile.html">TQFile</a> and <a href="tqregexp.html">TQRegExp</a> we need to include the relevant headers. (Right click "Includes (in Implementation)", then click <b>New</b>. Type "ntqfile.h" and press <b>Enter</b>. Repeat this process to add "tqregexp.h".)</p> <p>You should now have added the following declarations to your includes (in implementation):</p> <ul><li><p>"ntqfile.h"</p> -<li><p>"ntqregexp.h"</p> +<li><p>"tqregexp.h"</p> </ul><blockquote> <p align="center"><b> The Regular Expression</b></p> <p>The regex we've used can be broken up into the following pieces:</p> @@ -688,7 +688,7 @@ Captures: cap(1) cap(2) cap(3) cap(4) </pre> <p>Piece A says the regex must match from the beginning of the string, and piece F says the regex must match to the end of the string: so the regex must match the whole string or not match at all. The 'B' piece matches zero or more whitespaces (i.e. any leading whitespace), and the D pieces match one or more whitespaces (i.e. the gaps between each number). The 'C' pieces match one or more digits, i.e. the numbers. Piece E matches one or more non-whitespace followed by anything else, i.e. the name of the color.</p> <p>The parentheses are used to <em>capture</em> the parts of the match that they enclose. The captured parts are numbered from 1.</p> -<p>For more information on regexes see the <a href="ntqregexp.html">TQRegExp</a> documentation.</p> +<p>For more information on regexes see the <a href="tqregexp.html">TQRegExp</a> documentation.</p> </blockquote> <h4><a name="6-25"></a>fileSaveAs()</h4> <pre> void MainForm::fileSaveAs() |