summaryrefslogtreecommitdiffstats
path: root/examples3/tut11.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples3/tut11.py')
-rwxr-xr-xexamples3/tut11.py70
1 files changed, 35 insertions, 35 deletions
diff --git a/examples3/tut11.py b/examples3/tut11.py
index 95d5066..305994f 100755
--- a/examples3/tut11.py
+++ b/examples3/tut11.py
@@ -1,18 +1,18 @@
#!/usr/bin/env python
-# Qt tutorial 11.
+# TQt tutorial 11.
import sys
import math
import qt
-class LCDRange(qt.QVBox):
+class LCDRange(qt.TQVBox):
def __init__(self, parent=None, name=None):
- qt.QVBox.__init__(self, parent, name)
+ qt.TQVBox.__init__(self, parent, name)
- lcd = qt.QLCDNumber(2, self, "lcd")
- self.slider = qt.QSlider(qt.Qt.Horizontal, self, "slider")
+ lcd = qt.TQLCDNumber(2, self, "lcd")
+ self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider")
self.slider.setRange(0, 99)
self.slider.setValue(0)
self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)"))
@@ -32,23 +32,23 @@ class LCDRange(qt.QVBox):
self.slider.setRange(minVal, maxVal)
-class CannonField(qt.QWidget):
+class CannonField(qt.TQWidget):
def __init__(self, parent=None, name=None):
- qt.QWidget.__init__(self, parent, name)
+ qt.TQWidget.__init__(self, parent, name)
self.ang = 45
self.f = 0
self.timerCount = 0
- self.autoShootTimer = qt.QTimer(self, "movement handler")
+ self.autoShootTimer = qt.TQTimer(self, "movement handler")
self.connect(self.autoShootTimer, qt.SIGNAL("timeout()"), self.moveShot)
self.shoot_ang = 0
self.shoot_f = 0
- self.setPalette(qt.QPalette(qt.QColor(250, 250, 200)))
+ self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200)))
- self.barrelRect = qt.QRect(33, -4, 15, 8)
+ self.barrelRect = qt.TQRect(33, -4, 15, 8)
def angle(self):
return self.ang
@@ -85,7 +85,7 @@ class CannonField(qt.QWidget):
self.autoShootTimer.start(50)
def moveShot(self):
- r = qt.QRegion(self.shotRect())
+ r = qt.TQRegion(self.shotRect())
self.timerCount = self.timerCount + 1
shotR = self.shotRect()
@@ -93,13 +93,13 @@ class CannonField(qt.QWidget):
if shotR.x() > self.width() or shotR.y() > self.height():
self.autoShootTimer.stop()
else:
- r = r.unite(qt.QRegion(shotR))
+ r = r.unite(qt.TQRegion(shotR))
self.repaint(r)
def paintEvent(self, ev):
updateR = ev.rect()
- p = qt.QPainter(self)
+ p = qt.TQPainter(self)
if updateR.intersects(self.cannonRect()):
self.paintCannon(p)
@@ -108,21 +108,21 @@ class CannonField(qt.QWidget):
self.paintShot(p)
def paintShot(self, p):
- p.setBrush(qt.Qt.black)
- p.setPen(qt.Qt.NoPen)
+ p.setBrush(qt.TQt.black)
+ p.setPen(qt.TQt.NoPen)
p.drawRect(self.shotRect())
def paintCannon(self, p):
cr = self.cannonRect()
- pix = qt.QPixmap(cr.size())
+ pix = qt.TQPixmap(cr.size())
pix.fill(self, cr.topLeft())
- tmp = qt.QPainter(pix)
- tmp.setBrush(qt.Qt.blue)
- tmp.setPen(qt.Qt.NoPen)
+ tmp = qt.TQPainter(pix)
+ tmp.setBrush(qt.TQt.blue)
+ tmp.setPen(qt.TQt.NoPen)
tmp.translate(0, pix.height() - 1)
- tmp.drawPie(qt.QRect(-35, -35, 70, 70), 0, 90 * 16)
+ tmp.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16)
tmp.rotate(-self.ang)
tmp.drawRect(self.barrelRect)
tmp.end()
@@ -130,7 +130,7 @@ class CannonField(qt.QWidget):
p.drawPixmap(cr.topLeft(), pix)
def cannonRect(self):
- r = qt.QRect(0, 0, 50, 50)
+ r = qt.TQRect(0, 0, 50, 50)
r.moveBottomLeft(self.rect().bottomLeft())
return r
@@ -148,20 +148,20 @@ class CannonField(qt.QWidget):
x = x0 + velx * time
y = y0 + vely * time - 0.5 * gravity * time * time
- r = qt.QRect(0, 0, 6, 6)
- r.moveCenter(qt.QPoint(x, self.height() - 1 - y))
+ r = qt.TQRect(0, 0, 6, 6)
+ r.moveCenter(qt.TQPoint(x, self.height() - 1 - y))
return r
def sizePolicy(self):
- return qt.QSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding)
+ return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding)
-class MyWidget(qt.QWidget):
+class MyWidget(qt.TQWidget):
def __init__(self, parent=None, name=None):
- qt.QWidget.__init__(self, parent, name)
+ qt.TQWidget.__init__(self, parent, name)
- quit = qt.QPushButton("&Quit", self, "quit")
- quit.setFont(qt.QFont("Times", 18, qt.QFont.Bold))
+ quit = qt.TQPushButton("&Quit", self, "quit")
+ quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold))
self.connect(quit, qt.SIGNAL("clicked()"), qt.qApp, qt.SLOT("quit()"))
self.angle = LCDRange(self, "angle")
@@ -178,22 +178,22 @@ class MyWidget(qt.QWidget):
self.connect(self.force, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce)
self.connect(self.cannonField, qt.PYSIGNAL("forceChanged(int)"), self.force.setValue)
- shoot = qt.QPushButton("&Shoot", self, "shoot")
- shoot.setFont(qt.QFont("Times", 18, qt.QFont.Bold))
+ shoot = qt.TQPushButton("&Shoot", self, "shoot")
+ shoot.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold))
self.connect(shoot, qt.SIGNAL("clicked()"), self.cannonField.shoot)
- grid = qt.QGridLayout(self, 2, 2, 10)
+ grid = qt.TQGridLayout(self, 2, 2, 10)
grid.addWidget(quit, 0, 0)
grid.addWidget(self.cannonField, 1, 1)
grid.setColStretch(1, 10)
- leftBox = qt.QVBoxLayout()
+ leftBox = qt.TQVBoxLayout()
grid.addLayout(leftBox, 1, 0)
leftBox.addWidget(self.angle)
leftBox.addWidget(self.force)
- topBox = qt.QHBoxLayout()
+ topBox = qt.TQHBoxLayout()
grid.addLayout(topBox, 0, 1)
topBox.addWidget(shoot)
topBox.addStretch(1)
@@ -203,8 +203,8 @@ class MyWidget(qt.QWidget):
self.angle.setFocus()
-qt.QApplication.setColorSpec(qt.QApplication.CustomColor)
-a = qt.QApplication(sys.argv)
+qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor)
+a = qt.TQApplication(sys.argv)
w = MyWidget()
w.setGeometry(100, 100, 500, 355)