SIP4 python bindings for TQt
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/usr/bin/env python
  2. #****************************************************************************
  3. #** $Id: bigtable.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 = 1000000
  18. numCols = 1000000
  19. class MyTable(TQTable):
  20. def __init__(self, r, c):
  21. TQTable.__init__(self, r, c)
  22. self.items = {}
  23. self.widgets = {}
  24. self.setCaption("This is a big table with 1.000.000x1.000.000 cells...")
  25. self.setLeftMargin(self.fontMetrics().width("W999999W"))
  26. def resizeData(self, v):
  27. return
  28. def item(self, r, c):
  29. try:
  30. return self.items[self.indexOf(r, c)]
  31. except KeyError:
  32. return None
  33. def setItem(self, r, c, i):
  34. self.items[self.indexOf(r, c)] = i
  35. def clearCell(self, r, c):
  36. try:
  37. del self.items[self.indexOf(r, c)]
  38. except KeyError:
  39. pass
  40. def insertWidget(self, r, c, w):
  41. self.widgets[self.indexOf(r, c)] = w
  42. def cellWidget(self, r, c):
  43. try:
  44. return self.widgets[self.indexOf(r, c)]
  45. except KeyError:
  46. return None
  47. def clearCellWidget(self, r, c):
  48. try:
  49. del self.widgets[self.indexOf(r, c)]
  50. except KeyError:
  51. pass
  52. if __name__ == '__main__':
  53. app = TQApplication(sys.argv)
  54. table = MyTable(numRows, numCols)
  55. app.setMainWidget(table)
  56. table.show()
  57. app.exec_loop()