diff options
author | aneejit1 <[email protected]> | 2022-07-28 15:46:19 +0000 |
---|---|---|
committer | aneejit1 <[email protected]> | 2022-07-30 17:54:15 +0000 |
commit | e602246539fd7435aaeb440fcb7f852c92c8426b (patch) | |
tree | 35e09f5d93c67158e6c1160d6d9b27ae8a0bf966 /examples3/tooltip.py | |
parent | b34531364d5c0d3be7056d87011afd8bd538a0e7 (diff) | |
download | pytqt-e602246539fd7435aaeb440fcb7f852c92c8426b.tar.gz pytqt-e602246539fd7435aaeb440fcb7f852c92c8426b.zip |
Remove Qt V2 support and example files
Build files for pyuic2 have been removed along with the examples for
version 2 of Qt and the build/configure scripts have been amended
accordingly. The "examples3" directory has been renamed to just
"examples".
Signed-off-by: aneejit1 <[email protected]>
Diffstat (limited to 'examples3/tooltip.py')
-rwxr-xr-x | examples3/tooltip.py | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/examples3/tooltip.py b/examples3/tooltip.py deleted file mode 100755 index 13025e3..0000000 --- a/examples3/tooltip.py +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/env python - -"""************************************************************************** -** $Id: tooltip.py,v 1.1 2003/07/01 14:18:37 phil Exp $ -** -** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. -** -** This file is part of an example program for TQt. This example -** program may be used, distributed and modified without limitation. -** -***************************************************************************""" - -import sys -from python_tqt.qt import * -from random import random - -class DynamicTip( TQToolTip ): - def __init__( self, parent ): - TQToolTip.__init__( self, parent ) - - def maybeTip( self, pos ): - #if not self.parent.inherits( "TellMe" ): - if TQToolTip(self).parentWidget().inherits( "TellMe" ) : - return - r = TQRect( TQToolTip(self).parentWidget().tip(pos) ) - if not r.isValid(): - return - - s = TQString( "position: %d,%d" % (r.center().x(), r.center().y()) ) - TQToolTip(self).tip( r, s ) - - -class TellMe( TQWidget ): - def __init__( self, parent=None, name=None ): - TQWidget.__init__( self, parent, name ) - - self.setMinimumSize( 30, 30 ) - self.r1 = self.randomRect() - self.r2 = self.randomRect() - self.r3 = self.randomRect() - - self.t = DynamicTip( self ) - - TQToolTip.add( self, self.r3, "this color is called red" ) # <- helpful - - def paintEvent( self, e ): - - p = TQPainter( self ) - - # I try to be efficient here, and repaint only what's needed - if e.rect().intersects( self.r1 ): - p.setBrush( TQt.blue ) - p.drawRect( self.r1 ) - - if e.rect().intersects( self.r2 ): - p.setBrush( TQt.blue ) - p.drawRect( self.r2 ) - - if e.rect().intersects( self.r3 ): - p.setBrush( TQt.red ) - p.drawRect( self.r3 ) - - def mousePressEvent( self, e ): - - if self.r1.contains( e.pos() ): - self.r1 = self.randomRect() - if self.r2.contains( e.pos() ): - self.r2 = self.randomRect() - self.repaint() - - def resizeEvent( self, e ): - - if not self.rect().contains( self.r1 ): - self.r1 = self.randomRect() - if not self.rect().contains( self.r2 ): - self.r2 = self.randomRect() - - def randomRect( self ): - return TQRect( int(random() * (self.width() - 20)), int(random() * (self.height() - 20)), 20, 20 ) - - def tip( self, p ): - - if self.r1.contains( p ): - return self.r1 - elif self.r2.contains( p ): - return self.r2 - else: - return TQRect( 0,0, -1,-1 ) - - def __del__( self ): - del self.t - self.t = None - -def main( args ): - a = TQApplication( args ) - - mw = TellMe() - mw.setCaption( "TQt Example - Dynamic Tool Tips" ) - a.setMainWidget( mw ) - mw.show() - - a.exec_loop() - -if __name__=="__main__": - main(sys.argv) |