summaryrefslogtreecommitdiffstats
path: root/examples2/dropsite.py
diff options
context:
space:
mode:
authoraneejit1 <aneejit1@gmail.com>2022-07-28 15:46:19 +0000
committeraneejit1 <aneejit1@gmail.com>2022-07-30 17:54:15 +0000
commite602246539fd7435aaeb440fcb7f852c92c8426b (patch)
tree35e09f5d93c67158e6c1160d6d9b27ae8a0bf966 /examples2/dropsite.py
parentb34531364d5c0d3be7056d87011afd8bd538a0e7 (diff)
downloadpytqt-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 <aneejit1@gmail.com>
Diffstat (limited to 'examples2/dropsite.py')
-rw-r--r--examples2/dropsite.py96
1 files changed, 0 insertions, 96 deletions
diff --git a/examples2/dropsite.py b/examples2/dropsite.py
deleted file mode 100644
index 461b44e..0000000
--- a/examples2/dropsite.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# This is part of the dragdrop example.
-
-
-from python_tqt.qt import *
-
-import secret
-
-
-class DropSite(TQLabel):
- def __init__(self, parent=None, name=None):
- TQLabel.__init__( self, parent, name )
- self.setAcceptDrops(1)
-
- # this is a normal event
- def mousePressEvent( self, e ):
- if ( self.pixmap() ) :
- drobj = TQImageDrag( self.pixmap().convertToImage(), self )
- pm = TQPixmap()
- pm.convertFromImage(self.pixmap().convertToImage().smoothScale(
- self.pixmap().width()/3,self.pixmap().height()/3))
- drobj.setPixmap(pm,TQPoint(-5,-7))
- else :
- drobj = TQTextDrag( self.text(), self )
- drobj.dragCopy()
-
- def backgroundColorChange( self, qcolor ):
- # Reduce flicker by using repaint() rather than update()
- self.repaint()
-
- def dragMoveEvent( self, e ):
- # Check if you want the drag at e.pos()...
- # Give the user some feedback...
- pass
-
- def dragEnterEvent( self, e ):
- # Check if you want the drag...
- if (secret.canDecode( e ) or
- TQTextDrag.canDecode( e ) or
- TQImageDrag.canDecode( e ) or
- TQUriDrag.canDecode( e )):
- e.accept()
-
- # Give the user some feedback...
- t = ''
- i = 0
- while e.format( i ):
- if ( t != '' ):
- t += "\n"
- t += str(e.format( i ))
- i += 1
- self.emit(PYSIGNAL('message(TQString &)'), (TQString(t),))
- self.setPaletteBackgroundColor(TQt.white)
-
- def dragLeaveEvent( self, TQDragLeaveEvent ):
- # Give the user some feedback...
- self.emit(PYSIGNAL('message(TQString &)'), (TQString(''),))
- self.setPaletteBackgroundColor(TQt.lightGray)
-
- def dropEvent( self, e ):
- self.setPaletteBackgroundColor(TQt.lightGray)
- # Try to decode to the data you understand...
- str = TQString()
- if ( TQTextDrag.decode( e, str ) ) :
- self.setText( str )
- self.setMinimumSize( self.minimumSize().expandedTo(self.sizeHint()) )
- return
-
- pm = TQPixmap()
- if ( TQImageDrag.decode( e, pm ) ) :
- self.setPixmap( pm )
- self.setMinimumSize(self.minimumSize().expandedTo(self.sizeHint()))
- return
-
- # TQStrList strings
- #strings = TQStrList()
- strings = []
- if ( TQUriDrag.decode( e, strings ) ) :
- m = TQString("Full URLs:\n")
- for u in strings:
- m = m + " " + u + '\n'
- # TQStringList files
- files = []
- if ( TQUriDrag.decodeLocalFiles( e, files ) ) :
- m += "Files:\n"
- # for (TQStringList.Iterator i=files.begin() i!=files.end() ++i)
- for i in files:
- m = m + " " + i + '\n'
- self.setText( m )
- self.setMinimumSize(self.minimumSize().expandedTo(self.sizeHint()))
- return
-
- str = secret.decode( e )
- if str:
- self.setText( str )
- self.setMinimumSize(self.minimumSize().expandedTo(self.sizeHint()))
- return