SIP4 python bindings for TQt
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

smalltable.py 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/usr/bin/env python
  2. #****************************************************************************
  3. #** $Id: smalltable.py,v 1.1 2002/06/19 07:56:07 phil Exp $
  4. #**
  5. #** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved.
  6. #**
  7. #** This file is part of an example program for PyTQt. This example
  8. #** program may be used, distributed and modified without limitation.
  9. #**
  10. #*****************************************************************************/
  11. import sys
  12. import os
  13. from python_tqt.qt import *
  14. from python_tqt.qttable import *
  15. TRUE = 1
  16. FALSE = 0
  17. numRows = 30
  18. numCols = 10
  19. if __name__ == '__main__':
  20. app = TQApplication(sys.argv)
  21. table = TQTable(numRows, numCols)
  22. header = table.horizontalHeader()
  23. header.setLabel(0, "Tiny", 40)
  24. header.setLabel(1, "Checkboxes")
  25. header.setLabel(5, "Combos")
  26. header.setMovingEnabled(TRUE)
  27. img = TQImage("trolltech.bmp")
  28. pix = TQPixmap(img.scaleHeight(table.rowHeight(3)))
  29. table.setPixmap(3, 2, pix)
  30. table.setText(3, 2, "A Pixmap")
  31. comboEntries = TQStringList("one")
  32. comboEntries.append("two")
  33. comboEntries.append("three")
  34. comboEntries.append("four")
  35. for i in range(numRows):
  36. item = TQComboTableItem(table, comboEntries, FALSE)
  37. item.setCurrentItem(i % 4)
  38. table.setItem(i, 5, item)
  39. for i in range(numRows):
  40. table.setItem(i, 1, TQCheckTableItem(table, "Check me"))
  41. table.setCaption("Small table example")
  42. table.show()
  43. app.setMainWidget(table)
  44. app.exec_loop()