diff options
Diffstat (limited to 'doc/html/designer-manual-3.html')
| -rw-r--r-- | doc/html/designer-manual-3.html | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/doc/html/designer-manual-3.html b/doc/html/designer-manual-3.html index ec4039b32..b21cc226f 100644 --- a/doc/html/designer-manual-3.html +++ b/doc/html/designer-manual-3.html @@ -263,13 +263,13 @@ body { background: #ffffff; color: black; } <ul><li><p>class TQString;</p> <li><p>class TQColor;</p> </ul><h4><a name="6-3"></a>Adding Includes</h4> -<p>Our form will also need some included files. Includes may be added in the declaration, or (for preference) in the implementation. Right click "Includes (in Implementation)", then click <b>Edit</b>. Use the dialog that pops up to enter "ntqcolor.h" and "ntqstring.h". Since we're going to use the clipboard we'll need access to the global clipboard object via <a href="ntqapplication.html">TQApplication</a>, so also add "ntqapplication.h" and "ntqclipboard.h". We'll also be doing some drawing (e.g. the color swatches), so add "ntqpainter.h" too, then close the dialog.</p> +<p>Our form will also need some included files. Includes may be added in the declaration, or (for preference) in the implementation. Right click "Includes (in Implementation)", then click <b>Edit</b>. Use the dialog that pops up to enter "ntqcolor.h" and "tqstring.h". Since we're going to use the clipboard we'll need access to the global clipboard object via <a href="ntqapplication.html">TQApplication</a>, so also add "ntqapplication.h" and "ntqclipboard.h". We'll also be doing some drawing (e.g. the color swatches), so add "ntqpainter.h" too, then close the dialog.</p> <p align="center"><img align="middle" src="mw-editincimp.png" width="339" height="327"> </p> <p>When entering include files you can include double quotes or angle brackets if you wish; if you don't use either <em>TQt Designer</em> will put in double quotes automatically.</p> <p>You should now have added the following includes (in implementation):</p> <ul><li><p>"ntqcolor.h"</p> -<li><p>"ntqstring.h"</p> +<li><p>"tqstring.h"</p> <li><p>"ntqapplication.h"</p> <li><p>"ntqclipboard.h"</p> <li><p>"ntqpainter.h"</p> @@ -315,10 +315,10 @@ body { background: #ffffff; color: black; } const int COL_NAME = 0; const int COL_HEX = 1; const int COL_WEB = 2; - const <a href="ntqstring.html">TQString</a> WINDOWS_REGISTRY = "/TQtExamples"; - const <a href="ntqstring.html">TQString</a> APP_KEY = "/ColorTool/"; + const <a href="tqstring.html">TQString</a> WINDOWS_REGISTRY = "/TQtExamples"; + const <a href="tqstring.html">TQString</a> APP_KEY = "/ColorTool/"; </pre> - <p>We define some useful constants for our form since it's easier to remember "CLIP_AS_RGB" than "2". The two <a href="ntqstring.html">TQString</a>s are used by <a href="ntqsettings.html">TQSettings</a> when we come to load and save user preferences; they're explained when we cover <tt>loadOptions()</tt> and <tt>saveOptions()</tt>. Note that we can insert any valid C++ into a <tt>.ui.h</tt> file including constant declarations as we've done here and <tt>#include</tt>s, etc.</p> + <p>We define some useful constants for our form since it's easier to remember "CLIP_AS_RGB" than "2". The two <a href="tqstring.html">TQString</a>s are used by <a href="ntqsettings.html">TQSettings</a> when we come to load and save user preferences; they're explained when we cover <tt>loadOptions()</tt> and <tt>saveOptions()</tt>. Note that we can insert any valid C++ into a <tt>.ui.h</tt> file including constant declarations as we've done here and <tt>#include</tt>s, etc.</p> <p>Since we're not subclassing if we want to have code executed during construction we must create an <tt>init()</tt> function; this will be called at the end of the form's constructor.</p> <h4><a name="6-7"></a>init()</h4> <pre> void MainForm::init() @@ -525,7 +525,7 @@ body { background: #ffffff; color: black; } <h4><a name="6-18"></a>changedColor()</h4> <p>This is a function that we need to write from scratch. Simply enter its code into <em>TQt Designer</em>'s code editor and it will automatically appear in Object Explorer's Members tab (under Functions, public).</p> <p>By default any function that it typed directly into the code editor becomes a public function. To change this, right click the function's name in Object Explorer's Members list, and click <b>Properties</b> to invoke the <em>Edit Functions</em> dialog. This dialog can be used to change various attributes of the function, including changing it into a slot.</p> -<pre> void MainForm::changedColor( const <a href="ntqstring.html">TQString</a>& name ) +<pre> void MainForm::changedColor( const <a href="tqstring.html">TQString</a>& name ) { <a href="ntqcolor.html">TQColor</a> color = m_colors[name]; int r = color.<a href="ntqcolor.html#red">red</a>(); @@ -579,7 +579,7 @@ body { background: #ffffff; color: black; } <pre> bool MainForm::okToClear() { if ( m_changed ) { - <a href="ntqstring.html">TQString</a> msg; + <a href="tqstring.html">TQString</a> msg; if ( m_filename.isEmpty() ) msg = "Unnamed colors "; else @@ -609,10 +609,10 @@ body { background: #ffffff; color: black; } if ( ! okToClear() ) return; - <a href="ntqstring.html">TQString</a> filename = TQFileDialog::<a href="ntqfiledialog.html#getOpenFileName">getOpenFileName</a>( + <a href="tqstring.html">TQString</a> filename = TQFileDialog::<a href="ntqfiledialog.html#getOpenFileName">getOpenFileName</a>( TQString::null, "Colors (*.txt)", this, "file open", "Color Tool -- File Open" ); - if ( ! filename.<a href="ntqstring.html#isEmpty">isEmpty</a>() ) + if ( ! filename.<a href="tqstring.html#isEmpty">isEmpty</a>() ) load( filename ); else statusBar()->message( "File Open abandoned", 2000 ); @@ -623,7 +623,7 @@ body { background: #ffffff; color: black; } <p>You should now have added the following declaration to your includes (in implementation):</p> <ul><li><p>"ntqfiledialog.h"</p> </ul><h4><a name="6-24"></a>load()</h4> -<pre> void MainForm::load( const <a href="ntqstring.html">TQString</a>& filename ) +<pre> void MainForm::load( const <a href="tqstring.html">TQString</a>& filename ) { clearData( FALSE ); m_filename = filename; @@ -633,7 +633,7 @@ body { background: #ffffff; color: black; } statusBar()->message( TQString( "Loading '%1'..." ). arg( filename ) ); <a href="ntqtextstream.html">TQTextStream</a> stream( &file ); - <a href="ntqstring.html">TQString</a> line; + <a href="tqstring.html">TQString</a> line; while ( ! stream.<a href="ntqtextstream.html#eof">eof</a>() ) { line = stream.<a href="ntqtextstream.html#readLine">readLine</a>(); if ( regex.<a href="ntqregexp.html#search">search</a>( line ) == -1 ) @@ -693,10 +693,10 @@ Captures: cap(1) cap(2) cap(3) cap(4) <h4><a name="6-25"></a>fileSaveAs()</h4> <pre> void MainForm::fileSaveAs() { - <a href="ntqstring.html">TQString</a> filename = TQFileDialog::<a href="ntqfiledialog.html#getSaveFileName">getSaveFileName</a>( + <a href="tqstring.html">TQString</a> filename = TQFileDialog::<a href="ntqfiledialog.html#getSaveFileName">getSaveFileName</a>( TQString::null, "Colors (*.txt)", this, "file save as", "Color Tool -- File Save As" ); - if ( ! filename.<a href="ntqstring.html#isEmpty">isEmpty</a>() ) { + if ( ! filename.<a href="tqstring.html#isEmpty">isEmpty</a>() ) { int ans = 0; if ( TQFile::<a href="ntqfile.html#exists">exists</a>( filename ) ) ans = TQMessageBox::<a href="ntqmessagebox.html#warning">warning</a>( @@ -766,7 +766,7 @@ Captures: cap(1) cap(2) cap(3) cap(4) <h4><a name="6-29"></a>editCut()</h4> <pre> void MainForm::editCut() { - <a href="ntqstring.html">TQString</a> name; + <a href="tqstring.html">TQString</a> name; <a href="tqwidget.html">TQWidget</a> *visible = colorWidgetStack->visibleWidget(); statusBar()->message( TQString( "Deleting '%1'" ).arg( <a href="tqobject.html#name-prop">name</a> ) ); @@ -797,7 +797,7 @@ Captures: cap(1) cap(2) cap(3) cap(4) m_table_dirty = TRUE; } - if ( ! name.<a href="ntqstring.html#isNull">isNull</a>() ) { + if ( ! name.<a href="tqstring.html#isNull">isNull</a>() ) { m_colors.remove( <a href="tqobject.html#name-prop">name</a> ); m_changed = TRUE; statusBar()->message( TQString( "Deleted '%1'" ).arg( <a href="tqobject.html#name-prop">name</a> ), 5000 ); @@ -810,7 +810,7 @@ Captures: cap(1) cap(2) cap(3) cap(4) <h4><a name="6-30"></a>editCopy()</h4> <pre> void MainForm::editCopy() { - <a href="ntqstring.html">TQString</a> text; + <a href="tqstring.html">TQString</a> text; <a href="tqwidget.html">TQWidget</a> *visible = colorWidgetStack->visibleWidget(); if ( <a href="tqwidget.html#visible-prop">visible</a> == tablePage && colorTable->numRows() ) { @@ -821,7 +821,7 @@ Captures: cap(1) cap(2) cap(3) cap(4) <a href="qiconviewitem.html">TQIconViewItem</a> *item = colorIconView->currentItem(); text = item-><a href="qtableitem.html#text">text</a>(); } - if ( ! text.<a href="ntqstring.html#isNull">isNull</a>() ) { + if ( ! text.<a href="tqstring.html#isNull">isNull</a>() ) { <a href="ntqcolor.html">TQColor</a> color = m_colors[text]; switch ( m_clip_as ) { case CLIP_AS_HEX: text = color.<a href="ntqcolor.html#name">name</a>(); break; @@ -838,7 +838,7 @@ Captures: cap(1) cap(2) cap(3) cap(4) } } </pre> - <p>In this function we retrieve the name of the color from the current table row (or current icon, depending on the view). We then set a <a href="ntqstring.html">TQString</a> to the text we want to copy into the clipboard and copy it.</p> + <p>In this function we retrieve the name of the color from the current table row (or current icon, depending on the view). We then set a <a href="tqstring.html">TQString</a> to the text we want to copy into the clipboard and copy it.</p> <h3><a name="7"></a>Summary</h3> <p>In this chapter we have created a standard main-window style application. We have implemented menus, a toolbar and a main widget (a TQWidgetStack). We've also created signal and slot connections and implemented many custom slots. In the following chapter we will complete the application by implementing custom dialogs, and by making use of common dialogs where appropriate.</p> <!-- eof --> |
