From ea318d1431c89e647598c510c4245c6571aa5f46 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 26 Jan 2012 23:32:43 -0600 Subject: Update to latest tqt3 automated conversion --- doc/html/life-example.html | 70 +++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'doc/html/life-example.html') diff --git a/doc/html/life-example.html b/doc/html/life-example.html index f07f6127f..ed6771cd8 100644 --- a/doc/html/life-example.html +++ b/doc/html/life-example.html @@ -48,10 +48,10 @@ body { background: #ffffff; color: black; } #ifndef LIFE_H #define LIFE_H -#include <qframe.h> +#include <ntqframe.h> -class LifeWidget : public TQFrame +class LifeWidget : public TQFrame { Q_OBJECT public: @@ -71,7 +71,7 @@ protected: virtual void mouseMoveEvent( TQMouseEvent * ); virtual void mousePressEvent( TQMouseEvent * ); virtual void resizeEvent( TQResizeEvent * ); - void mouseHandle( const TQPoint &pos ); + void mouseHandle( const TQPoint &pos ); private: enum { MAXSIZE = 50, MINSIZE = 10, BORDER = 5 }; @@ -110,28 +110,28 @@ private: #include "life.h" -#include <qpainter.h> -#include <qdrawutil.h> -#include <qcheckbox.h> -#include <qevent.h> -#include <qapplication.h> +#include <ntqpainter.h> +#include <ntqdrawutil.h> +#include <ntqcheckbox.h> +#include <ntqevent.h> +#include <ntqapplication.h> // The main game of life widget LifeWidget::LifeWidget( int s, TQWidget *parent, const char *name ) - : TQFrame( parent, name ) + : TQFrame( parent, name ) { SCALE = s; maxi = maxj = 50; - setMinimumSize( MINSIZE * SCALE + 2 * BORDER, + setMinimumSize( MINSIZE * SCALE + 2 * BORDER, MINSIZE * SCALE + 2 * BORDER ); - setMaximumSize( MAXSIZE * SCALE + 2 * BORDER, + setMaximumSize( MAXSIZE * SCALE + 2 * BORDER, MAXSIZE * SCALE + 2 * BORDER ); - setSizeIncrement( SCALE, SCALE); + setSizeIncrement( SCALE, SCALE); clear(); - resize( maxi * SCALE + 2 * BORDER , maxj * SCALE + 2 * BORDER ); + resize( maxi * SCALE + 2 * BORDER , maxj * SCALE + 2 * BORDER ); } @@ -144,7 +144,7 @@ void LifeWidget::clear() for ( int j = 0; j < MAXSIZE + 2; j++ ) cells[t][i][j] = FALSE; - repaint(); + repaint(); } @@ -152,7 +152,7 @@ void LifeWidget::clear() // this is not in general TRUE, but in practice it's good enough for // this program -void LifeWidget::resizeEvent( TQResizeEvent * e ) +void LifeWidget::resizeEvent( TQResizeEvent * e ) { maxi = (e->size().width() - 2 * BORDER) / SCALE; maxj = (e->size().height() - 2 * BORDER) / SCALE; @@ -164,25 +164,25 @@ void LifeWidget::setPoint( int i, int j ) if ( i < 1 || i > maxi || j < 1 || j > maxi ) return; cells[current][i][j] = TRUE; - repaint( index2pos(i), index2pos(j), SCALE, SCALE, FALSE ); + repaint( index2pos(i), index2pos(j), SCALE, SCALE, FALSE ); } -void LifeWidget::mouseHandle( const TQPoint &pos ) +void LifeWidget::mouseHandle( const TQPoint &pos ) { - int i = pos2index( pos.x() ); - int j = pos2index( pos.y() ); + int i = pos2index( pos.x() ); + int j = pos2index( pos.y() ); setPoint( i, j ); } -void LifeWidget::mouseMoveEvent( TQMouseEvent *e ) +void LifeWidget::mouseMoveEvent( TQMouseEvent *e ) { mouseHandle( e->pos() ); } -void LifeWidget::mousePressEvent( TQMouseEvent *e ) +void LifeWidget::mousePressEvent( TQMouseEvent *e ) { if ( e->button() == TQMouseEvent::LeftButton ) mouseHandle( e->pos() ); @@ -207,11 +207,11 @@ void LifeWidget::nextGeneration() } } current = !current; - repaint( FALSE ); // repaint without erase + repaint( FALSE ); // repaint without erase } -void LifeWidget::paintEvent( TQPaintEvent * e ) +void LifeWidget::paintEvent( TQPaintEvent * e ) { int starti = pos2index( e->rect().left() ); int stopi = pos2index( e->rect().right() ); @@ -223,17 +223,17 @@ void LifeWidget::nextGeneration() if (stopj > maxj) stopj = maxj; - TQPainter paint( this ); + TQPainter paint( this ); for ( int i = starti; i <= stopi; i++ ) { for ( int j = startj; j <= stopj; j++ ) { if ( cells[current][i][j] ) - qDrawShadePanel( &paint, index2pos( i ), index2pos( j ), + qDrawShadePanel( &paint, index2pos( i ), index2pos( j ), SCALE - 1, SCALE - 1, colorGroup() ); else if ( cells[!current][i][j] ) - erase(index2pos( i ), index2pos( j ), SCALE - 1, SCALE - 1); + erase(index2pos( i ), index2pos( j ), SCALE - 1, SCALE - 1); } } - drawFrame( &paint ); + drawFrame( &paint ); } @@ -250,22 +250,22 @@ void LifeWidget::nextGeneration() *****************************************************************************/ #include "lifedlg.h" -#include <qapplication.h> +#include <ntqapplication.h> #include <stdlib.h> void usage() { - qWarning( "Usage: life [-scale scale]" ); + qWarning( "Usage: life [-scale scale]" ); } int main( int argc, char **argv ) { - TQApplication a( argc, argv ); + TQApplication a( argc, argv ); int scale = 10; for ( int i = 1; i < argc; i++ ){ - TQString arg = argv[i]; + TQString arg = argv[i]; if ( arg == "-scale" ) scale = atoi( argv[++i] ); else { @@ -278,11 +278,11 @@ int main( int argc, char **argv ) scale = 2; LifeDialog *life = new LifeDialog( scale ); - a.setMainWidget( life ); - life->setCaption("TQt Example - Life"); - life->show(); + a.setMainWidget( life ); + life->setCaption("TQt Example - Life"); + life->show(); - return a.exec(); + return a.exec(); } -- cgit v1.2.1