summaryrefslogtreecommitdiffstats
path: root/PerlQt/tutorials/t11/CannonField.pm
diff options
context:
space:
mode:
Diffstat (limited to 'PerlQt/tutorials/t11/CannonField.pm')
-rw-r--r--PerlQt/tutorials/t11/CannonField.pm38
1 files changed, 19 insertions, 19 deletions
diff --git a/PerlQt/tutorials/t11/CannonField.pm b/PerlQt/tutorials/t11/CannonField.pm
index 7ddfb24..0806f66 100644
--- a/PerlQt/tutorials/t11/CannonField.pm
+++ b/PerlQt/tutorials/t11/CannonField.pm
@@ -1,16 +1,16 @@
package CannonField;
use strict;
-use Qt;
-use Qt::isa qw(Qt::Widget);
-use Qt::signals
+use TQt;
+use TQt::isa qw(TQt::Widget);
+use TQt::signals
angleChanged => ['int'],
forceChanged => ['int'];
-use Qt::slots
+use TQt::slots
setAngle => ['int'],
setForce => ['int'],
shoot => [],
moveShot => [];
-use Qt::attributes qw(
+use TQt::attributes qw(
ang
f
@@ -30,11 +30,11 @@ sub NEW {
ang = 45;
f = 0;
timerCount = 0;
- autoShootTimer = Qt::Timer(this, "movement handler");
- this->connect(autoShootTimer, SIGNAL('timeout()'), SLOT('moveShot()'));
+ autoShootTimer = TQt::Timer(this, "movement handler");
+ this->connect(autoShootTimer, TQT_SIGNAL('timeout()'), TQT_SLOT('moveShot()'));
shoot_ang = 0;
shoot_f = 0;
- setPalette(Qt::Palette(Qt::Color(250, 250, 200)));
+ setPalette(TQt::Palette(TQt::Color(250, 250, 200)));
}
sub setAngle {
@@ -64,7 +64,7 @@ sub shoot {
}
sub moveShot {
- my $r = Qt::Region(shotRect());
+ my $r = TQt::Region(shotRect());
timerCount++;
my $shotR = shotRect();
@@ -72,7 +72,7 @@ sub moveShot {
if($shotR->x > width() || $shotR->y > height()) {
autoShootTimer->stop;
} else {
- $r = $r->unite(Qt::Region($shotR));
+ $r = $r->unite(TQt::Region($shotR));
}
repaint($r);
}
@@ -80,7 +80,7 @@ sub moveShot {
sub paintEvent {
my $e = shift;
my $updateR = $e->rect;
- my $p = Qt::Painter(this);
+ my $p = TQt::Painter(this);
paintCannon($p) if $updateR->intersects(cannonRect());
paintShot($p) if autoShootTimer->isActive and $updateR->intersects(shotRect());
@@ -93,20 +93,20 @@ sub paintShot {
$p->drawRect(shotRect());
}
-my $barrelRect = Qt::Rect(33, -4, 15, 8);
+my $barrelRect = TQt::Rect(33, -4, 15, 8);
sub paintCannon {
my $p = shift;
my $cr = cannonRect();
- my $pix = Qt::Pixmap($cr->size);
+ my $pix = TQt::Pixmap($cr->size);
$pix->fill(this, $cr->topLeft);
- my $tmp = Qt::Painter($pix);
+ my $tmp = TQt::Painter($pix);
$tmp->setBrush(&blue);
$tmp->setPen(&NoPen);
$tmp->translate(0, $pix->height - 1);
- $tmp->drawPie(Qt::Rect(-35, -35, 70, 70), 0, 90*16);
+ $tmp->drawPie(TQt::Rect(-35, -35, 70, 70), 0, 90*16);
$tmp->rotate(- ang);
$tmp->drawRect($barrelRect);
$tmp->end;
@@ -115,7 +115,7 @@ sub paintCannon {
}
sub cannonRect {
- my $r = Qt::Rect(0, 0, 50, 50);
+ my $r = TQt::Rect(0, 0, 50, 50);
$r->moveBottomLeft(rect()->bottomLeft);
return $r;
}
@@ -134,13 +134,13 @@ sub shotRect {
my $x = $x0 + $velx*$time;
my $y = $y0 + $vely*$time - 0.5*$gravity*$time**2;
- my $r = Qt::Rect(0, 0, 6, 6);
- $r->moveCenter(Qt::Point(int($x), height() - 1 - int($y)));
+ my $r = TQt::Rect(0, 0, 6, 6);
+ $r->moveCenter(TQt::Point(int($x), height() - 1 - int($y)));
return $r;
}
sub sizePolicy {
- Qt::SizePolicy(&Qt::SizePolicy::Expanding, &Qt::SizePolicy::Expanding);
+ TQt::SizePolicy(&TQt::SizePolicy::Expanding, &TQt::SizePolicy::Expanding);
}
1;