From 4e997a9c6e25689dca65a2ec573a599699ef8170 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 1 Jan 2012 18:24:37 -0600 Subject: Initial TQt conversion --- PerlQt/tutorials/t14/GameBoard.pm | 70 +++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'PerlQt/tutorials/t14/GameBoard.pm') diff --git a/PerlQt/tutorials/t14/GameBoard.pm b/PerlQt/tutorials/t14/GameBoard.pm index 96f9cbb..a81deef 100644 --- a/PerlQt/tutorials/t14/GameBoard.pm +++ b/PerlQt/tutorials/t14/GameBoard.pm @@ -1,13 +1,13 @@ package GameBoard; use strict; -use Qt; -use Qt::isa qw(Qt::Widget); -use Qt::slots +use TQt; +use TQt::isa qw(TQt::Widget); +use TQt::slots fire => [], hit => [], missed => [], newGame => []; -use Qt::attributes qw( +use TQt::attributes qw( hits shotsLeft cannonField @@ -19,10 +19,10 @@ use CannonField; sub NEW { shift->SUPER::NEW(@_); - my $quit = Qt::PushButton("&Quit", this, "quit"); - $quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + my $quit = TQt::PushButton("&Quit", this, "quit"); + $quit->setFont(TQt::Font("Times", 18, &TQt::Font::Bold)); - Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()')); + TQt::app->connect($quit, TQT_SIGNAL('clicked()'), TQT_SLOT('quit()')); my $angle = LCDRange("ANGLE", this, "angle"); $angle->setRange(5, 70); @@ -30,56 +30,56 @@ sub NEW { my $force = LCDRange("FORCE", this, "force"); $force->setRange(10, 50); - my $box = Qt::VBox(this, "cannonFrame"); + my $box = TQt::VBox(this, "cannonFrame"); $box->setFrameStyle($box->WinPanel | $box->Sunken); cannonField = CannonField($box, "cannonField"); - cannonField->connect($angle, SIGNAL('valueChanged(int)'), SLOT('setAngle(int)')); - $angle->connect(cannonField, SIGNAL('angleChanged(int)'), SLOT('setValue(int)')); + cannonField->connect($angle, TQT_SIGNAL('valueChanged(int)'), TQT_SLOT('setAngle(int)')); + $angle->connect(cannonField, TQT_SIGNAL('angleChanged(int)'), TQT_SLOT('setValue(int)')); - cannonField->connect($force, SIGNAL('valueChanged(int)'), SLOT('setForce(int)')); - $force->connect(cannonField, SIGNAL('forceChanged(int)'), SLOT('setValue(int)')); + cannonField->connect($force, TQT_SIGNAL('valueChanged(int)'), TQT_SLOT('setForce(int)')); + $force->connect(cannonField, TQT_SIGNAL('forceChanged(int)'), TQT_SLOT('setValue(int)')); - this->connect(cannonField, SIGNAL('hit()'), SLOT('hit()')); - this->connect(cannonField, SIGNAL('missed()'), SLOT('missed()')); + this->connect(cannonField, TQT_SIGNAL('hit()'), TQT_SLOT('hit()')); + this->connect(cannonField, TQT_SIGNAL('missed()'), TQT_SLOT('missed()')); - my $shoot = Qt::PushButton('&Shoot', this, "shoot"); - $shoot->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + my $shoot = TQt::PushButton('&Shoot', this, "shoot"); + $shoot->setFont(TQt::Font("Times", 18, &TQt::Font::Bold)); - this->connect($shoot, SIGNAL('clicked()'), SLOT('fire()')); + this->connect($shoot, TQT_SIGNAL('clicked()'), TQT_SLOT('fire()')); - $shoot->connect(cannonField, SIGNAL('canShoot(bool)'), SLOT('setEnabled(bool)')); + $shoot->connect(cannonField, TQT_SIGNAL('canShoot(bool)'), TQT_SLOT('setEnabled(bool)')); - my $restart = Qt::PushButton('&New Game', this, "newgame"); - $restart->setFont(Qt::Font("Times", 18, &Qt::Font::Bold)); + my $restart = TQt::PushButton('&New Game', this, "newgame"); + $restart->setFont(TQt::Font("Times", 18, &TQt::Font::Bold)); - this->connect($restart, SIGNAL('clicked()'), SLOT('newGame()')); + this->connect($restart, TQT_SIGNAL('clicked()'), TQT_SLOT('newGame()')); - hits = Qt::LCDNumber(2, this, "hits"); - shotsLeft = Qt::LCDNumber(2, this, "shotsleft"); - my $hitsL = Qt::Label("HITS", this, "hitsLabel"); - my $shotsLeftL = Qt::Label("SHOTS LEFT", this, "shotsLeftLabel"); + hits = TQt::LCDNumber(2, this, "hits"); + shotsLeft = TQt::LCDNumber(2, this, "shotsleft"); + my $hitsL = TQt::Label("HITS", this, "hitsLabel"); + my $shotsLeftL = TQt::Label("SHOTS LEFT", this, "shotsLeftLabel"); - my $accel = Qt::Accel(this); - $accel->connectItem($accel->insertItem(Qt::KeySequence(int &Key_Enter)), - this, SLOT('fire()')); - $accel->connectItem($accel->insertItem(Qt::KeySequence(int &Key_Return)), - this, SLOT('fire()')); - $accel->connectItem($accel->insertItem(Qt::KeySequence(int &CTRL+&Key_Q)), - Qt::app, SLOT('quit()')); + my $accel = TQt::Accel(this); + $accel->connectItem($accel->insertItem(TQt::KeySequence(int &Key_Enter)), + this, TQT_SLOT('fire()')); + $accel->connectItem($accel->insertItem(TQt::KeySequence(int &Key_Return)), + this, TQT_SLOT('fire()')); + $accel->connectItem($accel->insertItem(TQt::KeySequence(int &CTRL+&Key_Q)), + TQt::app, TQT_SLOT('quit()')); - my $grid = Qt::GridLayout(this, 2, 2, 10); + my $grid = TQt::GridLayout(this, 2, 2, 10); $grid->addWidget($quit, 0, 0); $grid->addWidget($box, 1, 1); $grid->setColStretch(1, 10); - my $leftBox = Qt::VBoxLayout; + my $leftBox = TQt::VBoxLayout; $grid->addLayout($leftBox, 1, 0); $leftBox->addWidget($angle); $leftBox->addWidget($force); - my $topBox = Qt::HBoxLayout; + my $topBox = TQt::HBoxLayout; $grid->addLayout($topBox, 0, 1); $topBox->addWidget($shoot); $topBox->addWidget(hits); -- cgit v1.2.1