summaryrefslogtreecommitdiffstats
path: root/doc/html/tutorial1-13.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/html/tutorial1-13.html')
-rw-r--r--doc/html/tutorial1-13.html90
1 files changed, 45 insertions, 45 deletions
diff --git a/doc/html/tutorial1-13.html b/doc/html/tutorial1-13.html
index 3153d87f9..b7aa3fcf6 100644
--- a/doc/html/tutorial1-13.html
+++ b/doc/html/tutorial1-13.html
@@ -59,14 +59,14 @@ implementation.
</h3>
<a name="1-1"></a><p>
-<p> <pre> #include &lt;<a href="qwidget-h.html">qwidget.h</a>&gt;
+<p> <pre> #include &lt;<a href="qwidget-h.html">ntqwidget.h</a>&gt;
class TQSlider;
class TQLabel;
- class LCDRange : public <a href="qwidget.html">TQWidget</a>
+ class LCDRange : public <a href="ntqwidget.html">TQWidget</a>
</pre>
-<p> We inherit <a href="qwidget.html">TQWidget</a> rather than <a href="qvbox.html">TQVBox</a>. TQVBox is very easy to use, but
+<p> We inherit <a href="ntqwidget.html">TQWidget</a> rather than <a href="ntqvbox.html">TQVBox</a>. TQVBox is very easy to use, but
again it showed its limitations so we switch to the more powerful and
slightly harder to use <a href="qvboxlayout.html">TQVBoxLayout</a>. (As you remember, TQVBoxLayout is
not a widget, it manages one.)
@@ -74,12 +74,12 @@ not a widget, it manages one.)
</h3>
<a name="1-2"></a><p>
-<p> <pre> #include &lt;<a href="qlayout-h.html">qlayout.h</a>&gt;
+<p> <pre> #include &lt;<a href="qlayout-h.html">ntqlayout.h</a>&gt;
</pre>
-<p> We need to include qlayout.h now to get the other layout management
+<p> We need to include ntqlayout.h now to get the other layout management
API.
-<p> <pre> LCDRange::LCDRange( <a href="qwidget.html">TQWidget</a> *parent, const char *name )
- : <a href="qwidget.html">TQWidget</a>( parent, name )
+<p> <pre> LCDRange::LCDRange( <a href="ntqwidget.html">TQWidget</a> *parent, const char *name )
+ : <a href="ntqwidget.html">TQWidget</a>( parent, name )
</pre>
<p> We inherit TQWidget in the usual way.
<p> The other constructor has the same change. init() is unchanged,
@@ -90,13 +90,13 @@ except that we've added some lines at the end:
widget's children.
<p> <pre> <a name="x2401"></a> l-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( lcd, 1 );
</pre>
-<p> At the top we add the <a href="qlcdnumber.html">TQLCDNumber</a> with a non-zero stretch.
+<p> At the top we add the <a href="ntqlcdnumber.html">TQLCDNumber</a> with a non-zero stretch.
<p> <pre> l-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( slider );
l-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( label );
</pre>
<p> Then we add the other two, both with the default zero stretch.
<p> This stretch control is something <a href="qvboxlayout.html">TQVBoxLayout</a> (and <a href="qhboxlayout.html">TQHBoxLayout</a>, and
-<a href="qgridlayout.html">TQGridLayout</a>) offers but classes like <a href="qvbox.html">TQVBox</a> do not. In this case
+<a href="qgridlayout.html">TQGridLayout</a>) offers but classes like <a href="ntqvbox.html">TQVBox</a> do not. In this case
we're saying that the TQLCDNumber should stretch and the others should
not.
<p> <h3> <a href="t13-cannon-h.html">t13/cannon.h</a>
@@ -136,7 +136,7 @@ over (luckily for the player :-).
timerCount = 0;
shoot_ang = ang;
shoot_f = f;
- <a name="x2407"></a> autoShootTimer-&gt;<a href="qtimer.html#start">start</a>( 50 );
+ <a name="x2407"></a> autoShootTimer-&gt;<a href="ntqtimer.html#start">start</a>( 50 );
emit canShoot( FALSE );
}
</pre>
@@ -148,9 +148,9 @@ cannot shoot now.
if ( gameEnded )
return;
if ( isShooting() )
- autoShootTimer-&gt;<a href="qtimer.html#stop">stop</a>();
+ autoShootTimer-&gt;<a href="ntqtimer.html#stop">stop</a>();
gameEnded = TRUE;
- <a href="qwidget.html#repaint">repaint</a>();
+ <a href="ntqwidget.html#repaint">repaint</a>();
}
</pre>
<p> This slot ends the game. It must be called from outside CannonField,
@@ -165,9 +165,9 @@ widget.
<p> <pre> void CannonField::restartGame()
{
if ( isShooting() )
- <a name="x2408"></a> autoShootTimer-&gt;<a href="qtimer.html#stop">stop</a>();
+ <a name="x2408"></a> autoShootTimer-&gt;<a href="ntqtimer.html#stop">stop</a>();
gameEnded = FALSE;
- <a href="qwidget.html#repaint">repaint</a>();
+ <a href="ntqwidget.html#repaint">repaint</a>();
emit canShoot( TRUE );
}
</pre>
@@ -176,15 +176,15 @@ We then reset the <tt>gameEnded</tt> variable and repaint the widget.
<p> moveShot() too emits the new canShoot(TRUE) signal at the same time as
either hit() or miss().
<p> Modifications in CannonField::paintEvent():
-<p> <pre> void CannonField::<a href="qwidget.html#paintEvent">paintEvent</a>( <a href="qpaintevent.html">TQPaintEvent</a> *e )
+<p> <pre> void CannonField::<a href="ntqwidget.html#paintEvent">paintEvent</a>( <a href="qpaintevent.html">TQPaintEvent</a> *e )
{
- <a name="x2405"></a> <a href="qrect.html">TQRect</a> updateR = e-&gt;<a href="qpaintevent.html#rect">rect</a>();
- <a href="qpainter.html">TQPainter</a> p( this );
+ <a name="x2405"></a> <a href="ntqrect.html">TQRect</a> updateR = e-&gt;<a href="qpaintevent.html#rect">rect</a>();
+ <a href="ntqpainter.html">TQPainter</a> p( this );
if ( gameEnded ) {
- p.<a href="qpainter.html#setPen">setPen</a>( black );
- <a name="x2403"></a> p.<a href="qpainter.html#setFont">setFont</a>( TQFont( "Courier", 48, TQFont::Bold ) );
- p.<a href="qpainter.html#drawText">drawText</a>( <a href="qwidget.html#rect">rect</a>(), AlignCenter, "Game Over" );
+ p.<a href="ntqpainter.html#setPen">setPen</a>( black );
+ <a name="x2403"></a> p.<a href="ntqpainter.html#setFont">setFont</a>( TQFont( "Courier", 48, TQFont::Bold ) );
+ p.<a href="ntqpainter.html#drawText">drawText</a>( <a href="ntqwidget.html#rect">rect</a>(), AlignCenter, "Game Over" );
}
</pre>
<p> The paint event has been enhanced to display the text "Game Over" if
@@ -198,11 +198,11 @@ rectangle. Unfortunately, on some systems (especially X servers with
Unicode fonts) it can take a while to load such a large font. Because
TQt caches fonts, you will notice this only the first time the font is
used.
-<p> <pre> <a name="x2406"></a> if ( updateR.<a href="qrect.html#intersects">intersects</a>( cannonRect() ) )
+<p> <pre> <a name="x2406"></a> if ( updateR.<a href="ntqrect.html#intersects">intersects</a>( cannonRect() ) )
paintCannon( &amp;p );
- if ( isShooting() &amp;&amp; updateR.<a href="qrect.html#intersects">intersects</a>( shotRect() ) )
+ if ( isShooting() &amp;&amp; updateR.<a href="ntqrect.html#intersects">intersects</a>( shotRect() ) )
paintShot( &amp;p );
- if ( !gameEnded &amp;&amp; updateR.<a href="qrect.html#intersects">intersects</a>( targetRect() ) )
+ if ( !gameEnded &amp;&amp; updateR.<a href="ntqrect.html#intersects">intersects</a>( targetRect() ) )
paintTarget( &amp;p );
}
</pre>
@@ -222,11 +222,11 @@ which was last seen as MyWidget.
#include "lcdrange.h"
#include "cannon.h"
- class GameBoard : public <a href="qwidget.html">TQWidget</a>
+ class GameBoard : public <a href="ntqwidget.html">TQWidget</a>
{
<a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a>
public:
- GameBoard( <a href="qwidget.html">TQWidget</a> *parent=0, const char *name=0 );
+ GameBoard( <a href="ntqwidget.html">TQWidget</a> *parent=0, const char *name=0 );
protected slots:
void fire();
@@ -235,8 +235,8 @@ which was last seen as MyWidget.
void newGame();
private:
- <a href="qlcdnumber.html">TQLCDNumber</a> *hits;
- <a href="qlcdnumber.html">TQLCDNumber</a> *shotsLeft;
+ <a href="ntqlcdnumber.html">TQLCDNumber</a> *hits;
+ <a href="ntqlcdnumber.html">TQLCDNumber</a> *shotsLeft;
CannonField *cannonField;
};
</pre>
@@ -256,15 +256,15 @@ class, which was last seen as MyWidget.
constructor to use it. (The <em>good</em> programmers at Trolltech never
forget this, but I do. Caveat programmor - if "programmor" is Latin,
at least. Anyway, back to the code.)
-<p> <pre> <a href="qobject.html#connect">connect</a>( cannonField, SIGNAL(hit()),
+<p> <pre> <a href="ntqobject.html#connect">connect</a>( cannonField, SIGNAL(hit()),
this, SLOT(hit()) );
- <a href="qobject.html#connect">connect</a>( cannonField, SIGNAL(missed()),
+ <a href="ntqobject.html#connect">connect</a>( cannonField, SIGNAL(missed()),
this, SLOT(missed()) );
</pre>
<p> This time we want to do something when the shot has hit or missed the
target. Thus we connect the hit() and missed() signals of the
CannonField to two protected slots with the same names in this class.
-<p> <pre> <a href="qobject.html#connect">connect</a>( shoot, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), SLOT(fire()) );
+<p> <pre> <a href="ntqobject.html#connect">connect</a>( shoot, SIGNAL(<a href="ntqbutton.html#clicked">clicked</a>()), SLOT(fire()) );
</pre>
<p> Previously we connected the Shoot button's clicked() signal directly
to the CannonField's shoot() slot. This time we want to keep track of
@@ -272,28 +272,28 @@ the number of shots fired, so we connect it to a protected slot in
this class instead.
<p> Notice how easy it is to change the behavior of a program when you are
working with self-contained components.
-<p> <pre> <a href="qobject.html#connect">connect</a>( cannonField, SIGNAL(canShoot(bool)),
- <a name="x2416"></a> shoot, SLOT(<a href="qwidget.html#setEnabled">setEnabled</a>(bool)) );
+<p> <pre> <a href="ntqobject.html#connect">connect</a>( cannonField, SIGNAL(canShoot(bool)),
+ <a name="x2416"></a> shoot, SLOT(<a href="ntqwidget.html#setEnabled">setEnabled</a>(bool)) );
</pre>
<p> We also use the cannonField's canShoot() signal to enable or disable
the Shoot button appropriately.
<p> <pre> TQPushButton *restart
- = new <a href="qpushbutton.html">TQPushButton</a>( "&amp;New Game", this, "newgame" );
+ = new <a href="ntqpushbutton.html">TQPushButton</a>( "&amp;New Game", this, "newgame" );
restart-&gt;setFont( TQFont( "Times", 18, TQFont::Bold ) );
- <a href="qobject.html#connect">connect</a>( restart, SIGNAL(clicked()), this, SLOT(newGame()) );
+ <a href="ntqobject.html#connect">connect</a>( restart, SIGNAL(clicked()), this, SLOT(newGame()) );
</pre>
<p> We create, set up, and connect the New Game button as we have done
with the other buttons. Clicking this button will activate the
newGame() slot in this widget.
-<p> <pre> hits = new <a href="qlcdnumber.html">TQLCDNumber</a>( 2, this, "hits" );
- shotsLeft = new <a href="qlcdnumber.html">TQLCDNumber</a>( 2, this, "shotsleft" );
- <a href="qlabel.html">TQLabel</a> *hitsL = new <a href="qlabel.html">TQLabel</a>( "HITS", this, "hitsLabel" );
+<p> <pre> hits = new <a href="ntqlcdnumber.html">TQLCDNumber</a>( 2, this, "hits" );
+ shotsLeft = new <a href="ntqlcdnumber.html">TQLCDNumber</a>( 2, this, "shotsleft" );
+ <a href="ntqlabel.html">TQLabel</a> *hitsL = new <a href="ntqlabel.html">TQLabel</a>( "HITS", this, "hitsLabel" );
TQLabel *shotsLeftL
- = new <a href="qlabel.html">TQLabel</a>( "SHOTS LEFT", this, "shotsleftLabel" );
+ = new <a href="ntqlabel.html">TQLabel</a>( "SHOTS LEFT", this, "shotsleftLabel" );
</pre>
<p> We create four new widgets. Note that we don't bother to keep the
-pointers to the <a href="qlabel.html">TQLabel</a> widgets in the GameBoard class because there's
+pointers to the <a href="ntqlabel.html">TQLabel</a> widgets in the GameBoard class because there's
nothing much we want to do with them. TQt will delete them when the
GameBoard widget is destroyed, and the layout classes will resize them
appropriately.
@@ -322,7 +322,7 @@ ordinary functions, too.)
{
if ( cannonField-&gt;gameOver() || cannonField-&gt;isShooting() )
return;
- shotsLeft-&gt;<a href="qlcdnumber.html#display">display</a>( shotsLeft-&gt;<a href="qlcdnumber.html#intValue">intValue</a>() - 1 );
+ shotsLeft-&gt;<a href="ntqlcdnumber.html#display">display</a>( shotsLeft-&gt;<a href="ntqlcdnumber.html#intValue">intValue</a>() - 1 );
cannonField-&gt;shoot();
}
</pre>
@@ -331,8 +331,8 @@ air, we return immediately. We decrement the number of shots left and tell
the cannon to shoot.
<p> <pre> void GameBoard::hit()
{
- hits-&gt;<a href="qlcdnumber.html#display">display</a>( hits-&gt;<a href="qlcdnumber.html#intValue">intValue</a>() + 1 );
- if ( shotsLeft-&gt;<a href="qlcdnumber.html#intValue">intValue</a>() == 0 )
+ hits-&gt;<a href="ntqlcdnumber.html#display">display</a>( hits-&gt;<a href="ntqlcdnumber.html#intValue">intValue</a>() + 1 );
+ if ( shotsLeft-&gt;<a href="ntqlcdnumber.html#intValue">intValue</a>() == 0 )
cannonField-&gt;setGameOver();
else
cannonField-&gt;newTarget();
@@ -343,7 +343,7 @@ number of hits. If there are no shots left, the game is over. Otherwise,
we make the CannonField generate a new target.
<p> <pre> void GameBoard::missed()
{
- <a name="x2415"></a> if ( shotsLeft-&gt;<a href="qlcdnumber.html#intValue">intValue</a>() == 0 )
+ <a name="x2415"></a> if ( shotsLeft-&gt;<a href="ntqlcdnumber.html#intValue">intValue</a>() == 0 )
cannonField-&gt;setGameOver();
}
</pre>
@@ -351,8 +351,8 @@ we make the CannonField generate a new target.
shots left, the game is over.
<p> <pre> void GameBoard::newGame()
{
- <a name="x2414"></a> shotsLeft-&gt;<a href="qlcdnumber.html#display">display</a>( 15 );
- hits-&gt;<a href="qlcdnumber.html#display">display</a>( 0 );
+ <a name="x2414"></a> shotsLeft-&gt;<a href="ntqlcdnumber.html#display">display</a>( 15 );
+ hits-&gt;<a href="ntqlcdnumber.html#display">display</a>( 0 );
cannonField-&gt;restartGame();
cannonField-&gt;newTarget();
}