summaryrefslogtreecommitdiffstats
path: root/doc/html/tictac-example.html
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-01-26 23:32:43 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-01-26 23:32:43 -0600
commitea318d1431c89e647598c510c4245c6571aa5f46 (patch)
tree996d29b80c30d453dda86d1a23162d441628f169 /doc/html/tictac-example.html
parentaaf89d4b48f69c9293feb187db26362e550b5561 (diff)
downloadtqt3-ea318d1431c89e647598c510c4245c6571aa5f46.tar.gz
tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.zip
Update to latest tqt3 automated conversion
Diffstat (limited to 'doc/html/tictac-example.html')
-rw-r--r--doc/html/tictac-example.html116
1 files changed, 58 insertions, 58 deletions
diff --git a/doc/html/tictac-example.html b/doc/html/tictac-example.html
index c1631b5b..b15ee645 100644
--- a/doc/html/tictac-example.html
+++ b/doc/html/tictac-example.html
@@ -54,8 +54,8 @@ widget.
#define TICTAC_H
-#include &lt;<a href="qpushbutton-h.html">qpushbutton.h</a>&gt;
-#include &lt;<a href="qptrvector-h.html">qptrvector.h</a>&gt;
+#include &lt;<a href="qpushbutton-h.html">ntqpushbutton.h</a>&gt;
+#include &lt;<a href="qptrvector-h.html">ntqptrvector.h</a>&gt;
class TQComboBox;
class TQLabel;
@@ -65,20 +65,20 @@ class TQLabel;
// TicTacButton implements a single tic-tac-toe button
//
-class TicTacButton : public <a href="qpushbutton.html">TQPushButton</a>
+class TicTacButton : public <a href="ntqpushbutton.html">TQPushButton</a>
{
<a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a>
public:
- TicTacButton( <a href="qwidget.html">TQWidget</a> *parent );
+ TicTacButton( <a href="ntqwidget.html">TQWidget</a> *parent );
enum Type { Blank, Circle, Cross };
Type type() const { return t; }
void setType( Type type ) { t = type; repaint(); }
- <a href="qsizepolicy.html">TQSizePolicy</a> sizePolicy() const
+ <a href="ntqsizepolicy.html">TQSizePolicy</a> sizePolicy() const
{ return TQSizePolicy( TQSizePolicy::Preferred, TQSizePolicy::Preferred ); }
- <a href="qsize.html">TQSize</a> sizeHint() const { return TQSize( 32, 32 ); }
- <a href="qsize.html">TQSize</a> minimumSizeHint() const { return TQSize( 10, 10 ); }
+ <a href="ntqsize.html">TQSize</a> sizeHint() const { return TQSize( 32, 32 ); }
+ <a href="ntqsize.html">TQSize</a> minimumSizeHint() const { return TQSize( 10, 10 ); }
protected:
- void drawButtonLabel( <a href="qpainter.html">TQPainter</a> * );
+ void drawButtonLabel( <a href="ntqpainter.html">TQPainter</a> * );
private:
Type t;
};
@@ -96,7 +96,7 @@ typedef TQMemArray&lt;int&gt; TicTacArray;
// N is specified in the constructor.
//
-class TicTacGameBoard : public <a href="qwidget.html">TQWidget</a>
+class TicTacGameBoard : public <a href="ntqwidget.html">TQWidget</a>
{
Q_OBJECT
public:
@@ -129,7 +129,7 @@ private:
// two push buttons for starting the game and quitting.
//
-class TicTacToe : public <a href="qwidget.html">TQWidget</a>
+class TicTacToe : public <a href="ntqwidget.html">TQWidget</a>
{
Q_OBJECT
public:
@@ -139,10 +139,10 @@ private slots:
void gameOver();
private:
void newState();
- <a href="qcombobox.html">TQComboBox</a> *whoStarts;
- <a href="qpushbutton.html">TQPushButton</a> *newGame;
- <a href="qpushbutton.html">TQPushButton</a> *quit;
- <a href="qlabel.html">TQLabel</a> *message;
+ <a href="ntqcombobox.html">TQComboBox</a> *whoStarts;
+ <a href="ntqpushbutton.html">TQPushButton</a> *newGame;
+ <a href="ntqpushbutton.html">TQPushButton</a> *quit;
+ <a href="ntqlabel.html">TQLabel</a> *message;
TicTacGameBoard *board;
};
@@ -163,15 +163,15 @@ private:
*****************************************************************************/
#include "tictac.h"
-#include &lt;<a href="qapplication-h.html">qapplication.h</a>&gt;
-#include &lt;<a href="qpainter-h.html">qpainter.h</a>&gt;
-#include &lt;<a href="qdrawutil-h.html">qdrawutil.h</a>&gt;
-#include &lt;<a href="qcombobox-h.html">qcombobox.h</a>&gt;
-#include &lt;<a href="qcheckbox-h.html">qcheckbox.h</a>&gt;
-#include &lt;<a href="qlabel-h.html">qlabel.h</a>&gt;
-#include &lt;<a href="qlayout-h.html">qlayout.h</a>&gt;
+#include &lt;<a href="qapplication-h.html">ntqapplication.h</a>&gt;
+#include &lt;<a href="qpainter-h.html">ntqpainter.h</a>&gt;
+#include &lt;<a href="qdrawutil-h.html">ntqdrawutil.h</a>&gt;
+#include &lt;<a href="qcombobox-h.html">ntqcombobox.h</a>&gt;
+#include &lt;<a href="qcheckbox-h.html">ntqcheckbox.h</a>&gt;
+#include &lt;<a href="qlabel-h.html">ntqlabel.h</a>&gt;
+#include &lt;<a href="qlayout-h.html">ntqlayout.h</a>&gt;
#include &lt;stdlib.h&gt; // rand() function
-#include &lt;<a href="qdatetime-h.html">qdatetime.h</a>&gt; // seed for rand()
+#include &lt;<a href="qdatetime-h.html">ntqdatetime.h</a>&gt; // seed for rand()
//***************************************************************************
@@ -182,7 +182,7 @@ private:
// Creates a TicTacButton
//
-<a name="f188"></a>TicTacButton::TicTacButton( <a href="qwidget.html">TQWidget</a> *parent ) : <a href="qpushbutton.html">TQPushButton</a>( parent )
+<a name="f188"></a>TicTacButton::TicTacButton( <a href="ntqwidget.html">TQWidget</a> *parent ) : <a href="ntqpushbutton.html">TQPushButton</a>( parent )
{
t = Blank; // initial type
}
@@ -191,15 +191,15 @@ private:
// Paints TicTacButton
//
-<a name="x31"></a>void TicTacButton::<a href="qbutton.html#drawButtonLabel">drawButtonLabel</a>( <a href="qpainter.html">TQPainter</a> *p )
+<a name="x31"></a>void TicTacButton::<a href="ntqbutton.html#drawButtonLabel">drawButtonLabel</a>( <a href="ntqpainter.html">TQPainter</a> *p )
{
- <a href="qrect.html">TQRect</a> r = <a href="qwidget.html#rect">rect</a>();
- p-&gt;<a href="qpainter.html#setPen">setPen</a>( TQPen( white,2 ) ); // set fat pen
+ <a href="ntqrect.html">TQRect</a> r = <a href="ntqwidget.html#rect">rect</a>();
+ p-&gt;<a href="ntqpainter.html#setPen">setPen</a>( TQPen( white,2 ) ); // set fat pen
if ( t == Circle ) {
-<a name="x36"></a><a name="x35"></a><a name="x28"></a> p-&gt;<a href="qpainter.html#drawEllipse">drawEllipse</a>( r.<a href="qrect.html#left">left</a>()+4, r.<a href="qrect.html#top">top</a>()+4, r.<a href="qrect.html#width">width</a>()-8, r.<a href="qrect.html#height">height</a>()-8 );
+<a name="x36"></a><a name="x35"></a><a name="x28"></a> p-&gt;<a href="ntqpainter.html#drawEllipse">drawEllipse</a>( r.<a href="ntqrect.html#left">left</a>()+4, r.<a href="ntqrect.html#top">top</a>()+4, r.<a href="ntqrect.html#width">width</a>()-8, r.<a href="ntqrect.html#height">height</a>()-8 );
} else if ( t == Cross ) { // draw cross
-<a name="x37"></a><a name="x33"></a> p-&gt;<a href="qpainter.html#drawLine">drawLine</a>( r.<a href="qrect.html#topLeft">topLeft</a>() +TQPoint(4,4), r.<a href="qrect.html#bottomRight">bottomRight</a>()-TQPoint(4,4));
-<a name="x38"></a><a name="x32"></a> p-&gt;<a href="qpainter.html#drawLine">drawLine</a>( r.<a href="qrect.html#bottomLeft">bottomLeft</a>()+TQPoint(4,-4),r.<a href="qrect.html#topRight">topRight</a>() -TQPoint(4,-4));
+<a name="x37"></a><a name="x33"></a> p-&gt;<a href="ntqpainter.html#drawLine">drawLine</a>( r.<a href="ntqrect.html#topLeft">topLeft</a>() +TQPoint(4,4), r.<a href="ntqrect.html#bottomRight">bottomRight</a>()-TQPoint(4,4));
+<a name="x38"></a><a name="x32"></a> p-&gt;<a href="ntqpainter.html#drawLine">drawLine</a>( r.<a href="ntqrect.html#bottomLeft">bottomLeft</a>()+TQPoint(4,-4),r.<a href="ntqrect.html#topRight">topRight</a>() -TQPoint(4,-4));
}
}
@@ -214,7 +214,7 @@ private:
//
<a name="f189"></a>TicTacGameBoard::TicTacGameBoard( int n, TQWidget *parent, const char *name )
- : <a href="qwidget.html">TQWidget</a>( parent, name )
+ : <a href="ntqwidget.html">TQWidget</a>( parent, name )
{
st = Init; // initial state
nBoard = n;
@@ -223,12 +223,12 @@ private:
buttons = new TicTacButtons(n); // create real buttons
btArray = new TicTacArray(n); // create button model
<a href="qgridlayout.html">TQGridLayout</a> * grid = new <a href="qgridlayout.html">TQGridLayout</a>( this, nBoard, nBoard, 4 );
- <a href="qpalette.html">TQPalette</a> p( blue );
+ <a href="ntqpalette.html">TQPalette</a> p( blue );
for ( int i=0; i&lt;n; i++ ) { // create and connect buttons
TicTacButton *ttb = new TicTacButton( this );
-<a name="x45"></a> ttb-&gt;<a href="qwidget.html#setPalette">setPalette</a>( p );
- ttb-&gt;<a href="qwidget.html#setEnabled">setEnabled</a>( FALSE );
- <a href="qobject.html#connect">connect</a>( ttb, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), SLOT(buttonClicked()) );
+<a name="x45"></a> ttb-&gt;<a href="ntqwidget.html#setPalette">setPalette</a>( p );
+ ttb-&gt;<a href="ntqwidget.html#setEnabled">setEnabled</a>( FALSE );
+ <a href="ntqobject.html#connect">connect</a>( ttb, SIGNAL(<a href="ntqbutton.html#clicked">clicked</a>()), SLOT(buttonClicked()) );
grid-&gt;<a href="qgridlayout.html#addWidget">addWidget</a>( ttb, i%nBoard, i/nBoard );
buttons-&gt;insert( i, ttb );
btArray-&gt;at(i) = TicTacButton::Blank; // initial button type
@@ -285,7 +285,7 @@ void <a name="f192"></a>TicTacGameBoard::buttonClicked()
{
if ( st != HumansTurn ) // not ready
return;
- int i = buttons-&gt;findRef( (TicTacButton*)<a href="qobject.html#sender">sender</a>() );
+ int i = buttons-&gt;findRef( (TicTacButton*)<a href="ntqobject.html#sender">sender</a>() );
TicTacButton *b = buttons-&gt;at(i); // get piece that was pressed
if ( b-&gt;type() == TicTacButton::Blank ) { // empty piece?
btArray-&gt;at(i) = TicTacButton::Circle;
@@ -441,45 +441,45 @@ void <a name="f195"></a>TicTacGameBoard::computerMove()
//
<a name="f196"></a>TicTacToe::TicTacToe( int boardSize, TQWidget *parent, const char *name )
- : <a href="qwidget.html">TQWidget</a>( parent, name )
+ : <a href="ntqwidget.html">TQWidget</a>( parent, name )
{
<a href="qvboxlayout.html">TQVBoxLayout</a> * l = new <a href="qvboxlayout.html">TQVBoxLayout</a>( this, 6 );
// Create a message label
- message = new <a href="qlabel.html">TQLabel</a>( this );
-<a name="x24"></a> message-&gt;<a href="qframe.html#setFrameStyle">setFrameStyle</a>( TQFrame::WinPanel | TQFrame::Sunken );
- message-&gt;<a href="qlabel.html#setAlignment">setAlignment</a>( AlignCenter );
+ message = new <a href="ntqlabel.html">TQLabel</a>( this );
+<a name="x24"></a> message-&gt;<a href="ntqframe.html#setFrameStyle">setFrameStyle</a>( TQFrame::WinPanel | TQFrame::Sunken );
+ message-&gt;<a href="ntqlabel.html#setAlignment">setAlignment</a>( AlignCenter );
l-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( message );
// Create the game board and connect the signal finished() to this
// gameOver() slot
board = new TicTacGameBoard( boardSize, this );
- <a href="qobject.html#connect">connect</a>( board, SIGNAL(finished()), SLOT(gameOver()) );
+ <a href="ntqobject.html#connect">connect</a>( board, SIGNAL(finished()), SLOT(gameOver()) );
l-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( board );
// Create a horizontal frame line
- <a href="qframe.html">TQFrame</a> *line = new <a href="qframe.html">TQFrame</a>( this );
- line-&gt;<a href="qframe.html#setFrameStyle">setFrameStyle</a>( TQFrame::HLine | TQFrame::Sunken );
+ <a href="ntqframe.html">TQFrame</a> *line = new <a href="ntqframe.html">TQFrame</a>( this );
+ line-&gt;<a href="ntqframe.html#setFrameStyle">setFrameStyle</a>( TQFrame::HLine | TQFrame::Sunken );
l-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( line );
// Create the combo box for deciding who should start, and
// connect its clicked() signals to the buttonClicked() slot
- whoStarts = new <a href="qcombobox.html">TQComboBox</a>( this );
-<a name="x23"></a> whoStarts-&gt;<a href="qcombobox.html#insertItem">insertItem</a>( "Computer starts" );
- whoStarts-&gt;<a href="qcombobox.html#insertItem">insertItem</a>( "Human starts" );
+ whoStarts = new <a href="ntqcombobox.html">TQComboBox</a>( this );
+<a name="x23"></a> whoStarts-&gt;<a href="ntqcombobox.html#insertItem">insertItem</a>( "Computer starts" );
+ whoStarts-&gt;<a href="ntqcombobox.html#insertItem">insertItem</a>( "Human starts" );
l-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( whoStarts );
// Create the push buttons and connect their clicked() signals
// to this right slots.
- newGame = new <a href="qpushbutton.html">TQPushButton</a>( "Play!", this );
- <a href="qobject.html#connect">connect</a>( newGame, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), SLOT(newGameClicked()) );
- quit = new <a href="qpushbutton.html">TQPushButton</a>( "Quit", this );
- <a href="qobject.html#connect">connect</a>( quit, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), qApp, SLOT(<a href="qapplication.html#quit">quit</a>()) );
+ newGame = new <a href="ntqpushbutton.html">TQPushButton</a>( "Play!", this );
+ <a href="ntqobject.html#connect">connect</a>( newGame, SIGNAL(<a href="ntqbutton.html#clicked">clicked</a>()), SLOT(newGameClicked()) );
+ quit = new <a href="ntqpushbutton.html">TQPushButton</a>( "Quit", this );
+ <a href="ntqobject.html#connect">connect</a>( quit, SIGNAL(<a href="ntqbutton.html#clicked">clicked</a>()), qApp, SLOT(<a href="ntqapplication.html#quit">quit</a>()) );
<a href="qhboxlayout.html">TQHBoxLayout</a> * b = new <a href="qhboxlayout.html">TQHBoxLayout</a>;
<a name="x19"></a> l-&gt;<a href="qboxlayout.html#addLayout">addLayout</a>( b );
b-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( newGame );
@@ -497,7 +497,7 @@ void <a name="f195"></a>TicTacGameBoard::computerMove()
void <a name="f197"></a>TicTacToe::newGameClicked()
{
-<a name="x22"></a> board-&gt;computerStarts( whoStarts-&gt;<a href="qcombobox.html#currentItem">currentItem</a>() == 0 );
+<a name="x22"></a> board-&gt;computerStarts( whoStarts-&gt;<a href="ntqcombobox.html#currentItem">currentItem</a>() == 0 );
board-&gt;newGame();
newState();
}
@@ -525,7 +525,7 @@ void <a name="f199"></a>TicTacToe::newState()
static const char *msg[] = { // TicTacGameBoard::State texts
"Click Play to start", "Make your move",
"You won!", "Computer won!", "It's a draw" };
- message-&gt;<a href="qlabel.html#setText">setText</a>( msg[board-&gt;state()] );
+ message-&gt;<a href="ntqlabel.html#setText">setText</a>( msg[board-&gt;state()] );
return;
}
</pre>
@@ -542,26 +542,26 @@ void <a name="f199"></a>TicTacToe::newState()
**
*****************************************************************************/
-#include &lt;<a href="qapplication-h.html">qapplication.h</a>&gt;
+#include &lt;<a href="qapplication-h.html">ntqapplication.h</a>&gt;
#include &lt;stdlib.h&gt;
#include "tictac.h"
int main( int argc, char **argv )
{
- <a href="qapplication.html">TQApplication</a> a( argc, argv );
+ <a href="ntqapplication.html">TQApplication</a> a( argc, argv );
int n = 3;
if ( argc == 2 ) // get board size n
n = atoi(argv[1]);
if ( n &lt; 3 || n &gt; 10 ) { // out of range
- <a href="qapplication.html#qWarning">qWarning</a>( "%s: Board size must be from 3x3 to 10x10", argv[0] );
+ <a href="ntqapplication.html#qWarning">qWarning</a>( "%s: Board size must be from 3x3 to 10x10", argv[0] );
return 1;
}
TicTacToe ttt( n ); // create game
- a.<a href="qapplication.html#setMainWidget">setMainWidget</a>( &amp;ttt );
- ttt.<a href="qwidget.html#setCaption">setCaption</a>("TQt Example - TicTac");
- ttt.<a href="qwidget.html#show">show</a>(); // show widget
- return a.<a href="qapplication.html#exec">exec</a>(); // go
+ a.<a href="ntqapplication.html#setMainWidget">setMainWidget</a>( &amp;ttt );
+ ttt.<a href="ntqwidget.html#setCaption">setCaption</a>("TQt Example - TicTac");
+ ttt.<a href="ntqwidget.html#show">show</a>(); // show widget
+ return a.<a href="ntqapplication.html#exec">exec</a>(); // go
}
</pre>