diff options
Diffstat (limited to 'examples3/tooltip.py')
-rwxr-xr-x | examples3/tooltip.py | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/examples3/tooltip.py b/examples3/tooltip.py index 7eadb7f..040d548 100755 --- a/examples3/tooltip.py +++ b/examples3/tooltip.py @@ -5,7 +5,7 @@ ** ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. ** -** This file is part of an example program for Qt. This example +** This file is part of an example program for TQt. This example ** program may be used, distributed and modified without limitation. ** ***************************************************************************""" @@ -14,25 +14,25 @@ import sys from qt import * from random import random -class DynamicTip( QToolTip ): +class DynamicTip( TQToolTip ): def __init__( self, parent ): - QToolTip.__init__( self, parent ) + TQToolTip.__init__( self, parent ) def maybeTip( self, pos ): #if not self.parent.inherits( "TellMe" ): - if QToolTip(self).parentWidget().inherits( "TellMe" ) : + if TQToolTip(self).parentWidget().inherits( "TellMe" ) : return - r = QRect( QToolTip(self).parentWidget().tip(pos) ) + r = TQRect( TQToolTip(self).parentWidget().tip(pos) ) if not r.isValid(): return - s = QString( "position: %d,%d" % (r.center().x(), r.center().y()) ) - QToolTip(self).tip( r, s ) + s = TQString( "position: %d,%d" % (r.center().x(), r.center().y()) ) + TQToolTip(self).tip( r, s ) -class TellMe( QWidget ): +class TellMe( TQWidget ): def __init__( self, parent=None, name=None ): - QWidget.__init__( self, parent, name ) + TQWidget.__init__( self, parent, name ) self.setMinimumSize( 30, 30 ) self.r1 = self.randomRect() @@ -41,23 +41,23 @@ class TellMe( QWidget ): self.t = DynamicTip( self ) - QToolTip.add( self, self.r3, "this color is called red" ) # <- helpful + TQToolTip.add( self, self.r3, "this color is called red" ) # <- helpful def paintEvent( self, e ): - p = QPainter( self ) + p = TQPainter( self ) # I try to be efficient here, and repaint only what's needed if e.rect().intersects( self.r1 ): - p.setBrush( Qt.blue ) + p.setBrush( TQt.blue ) p.drawRect( self.r1 ) if e.rect().intersects( self.r2 ): - p.setBrush( Qt.blue ) + p.setBrush( TQt.blue ) p.drawRect( self.r2 ) if e.rect().intersects( self.r3 ): - p.setBrush( Qt.red ) + p.setBrush( TQt.red ) p.drawRect( self.r3 ) def mousePressEvent( self, e ): @@ -76,7 +76,7 @@ class TellMe( QWidget ): self.r2 = self.randomRect() def randomRect( self ): - return QRect( random() * (self.width() - 20), random() * (self.height() - 20), 20, 20 ) + return TQRect( random() * (self.width() - 20), random() * (self.height() - 20), 20, 20 ) def tip( self, p ): @@ -85,17 +85,17 @@ class TellMe( QWidget ): elif self.r2.contains( p ): return self.r2 else: - return QRect( 0,0, -1,-1 ) + return TQRect( 0,0, -1,-1 ) def __del__( self ): del self.t self.t = None def main( args ): - a = QApplication( args ) + a = TQApplication( args ) mw = TellMe() - mw.setCaption( "Qt Example - Dynamic Tool Tips" ) + mw.setCaption( "TQt Example - Dynamic Tool Tips" ) a.setMainWidget( mw ) mw.show() |