SIP4 python bindings for TQt
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

dragdrop.py 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/usr/bin/env python
  2. # Ported to PyTQt by Issac Trotts on Jan 1, 2002
  3. import sys
  4. from python_tqt.qt import *
  5. import dropsite, secret
  6. def addStuff( parent, yn_image, yn_secret = 0 ):
  7. tll = TQVBoxLayout( parent, 10 )
  8. d = dropsite.DropSite( parent, 'dropsite' )
  9. d.setFrameStyle( TQFrame.Sunken + TQFrame.WinPanel )
  10. tll.addWidget( d )
  11. if yn_image:
  12. stuff = TQPixmap()
  13. if not stuff.load( "trolltech.bmp" ):
  14. stuff = TQPixmap(20,20)
  15. stuff.fill(TQt.green)
  16. d.setPixmap( stuff )
  17. else:
  18. d.setText("Drag and Drop")
  19. d.setFont(TQFont("Helvetica",18))
  20. if secret:
  21. s = secret.SecretSource( 42, parent )
  22. tll.addWidget( s )
  23. format = TQLabel( "\n\n\n\nNone\n\n\n\n", parent )
  24. tll.addWidget( format )
  25. tll.activate()
  26. parent.resize( parent.sizeHint() )
  27. TQObject.connect( d, PYSIGNAL('message(TQString &)'),
  28. format, SLOT('setText(TQString &)') )
  29. app = TQApplication( sys.argv )
  30. mw = TQWidget()
  31. addStuff( mw, 1 )
  32. mw.setCaption( "TQt Example - Drag and Drop" )
  33. mw.show()
  34. mw2 = TQWidget()
  35. addStuff( mw2, 0 )
  36. mw2.setCaption( "TQt Example - Drag and Drop" )
  37. mw2.show()
  38. mw3 = TQWidget()
  39. addStuff( mw3, 1, 1 )
  40. mw3.setCaption( "TQt Example - Drag and Drop" )
  41. mw3.show()
  42. TQObject.connect(tqApp,SIGNAL('lastWindowClosed()'),tqApp,SLOT('quit()'))
  43. app.exec_loop()