diff options
| author | aneejit1 <aneejit1@gmail.com> | 2022-07-28 15:46:19 +0000 | 
|---|---|---|
| committer | Slávek Banko <slavek.banko@axis.cz> | 2022-07-31 16:41:03 +0200 | 
| commit | 4978511ebb7e8d31dab64485d1ac87b6e004be81 (patch) | |
| tree | a2da3161f070116baa15de7276c5c0c9ac855e8f /examples2/table.py | |
| parent | 5916692cf4c4df4f808e346c9bda1604960a0ff3 (diff) | |
| download | pytqt-4978511ebb7e8d31dab64485d1ac87b6e004be81.tar.gz pytqt-4978511ebb7e8d31dab64485d1ac87b6e004be81.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>
(cherry picked from commit e602246539fd7435aaeb440fcb7f852c92c8426b)
Diffstat (limited to 'examples2/table.py')
| -rwxr-xr-x | examples2/table.py | 115 | 
1 files changed, 0 insertions, 115 deletions
| diff --git a/examples2/table.py b/examples2/table.py deleted file mode 100755 index f9db886..0000000 --- a/examples2/table.py +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env python - -import sys -from python_tqt.qt import * - -class Table(TQTableView): -  def __init__(self, numRows, numCols, parent=None, name=''): -    TQTableView.__init__(self, parent, name) -    self.curRow = self.curCol = 0 -    self.setFocusPolicy(TQWidget.StrongFocus) -    self.setBackgroundMode(TQWidget.PaletteBase) -    self.setNumCols(numCols) -    self.setNumRows(numRows) -    self.setCellWidth(100) -    self.setCellHeight(30) -    self.setTableFlags(Tbl_vScrollBar | -                       Tbl_hScrollBar | -                       Tbl_clipCellPainting) -    self.resize(400,200) -    self.contents = [''] * (numRows * numCols) -   -  def cellContent(self, row, col): -    return self.contents[self.indexOf(row,col)] - -  def setCellContent(self, row, col, c): -    self.contents[self.indexOf(row,col)] = c -    self.updateCell(row, col) - -  def paintCell(self, p, row, col): -    w = self.cellWidth(col) -    h = self.cellHeight(row) -    x2 = w-1 -    y2 = h-1 - -    p.drawLine(x2,0,x2,y2) -    p.drawLine(0,y2,x2,y2) - -    if row == self.curRow and col == self.curCol: -      if self.hasFocus(): -        p.drawRect(0, 0, x2, y2) -      else: -        p.setPen(TQt.DotLine) -        p.drawRect(0, 0, x2, y2) -        p.setPen(TQt.SolidLine) - -    p.drawText(0,0,w,h,TQt.AlignCenter,self.contents[self.indexOf(row,col)]) - -  def mousePressEvent(self, me): -    oldRow = self.curRow -    oldCol = self.curCol -    clickedPos = me.pos() -    self.curRow = self.findRow(clickedPos.y()) -    self.curCol = self.findCol(clickedPos.x()) -    if self.curRow != oldRow or \ -       self.curCol != oldCol: -      self.updateCell(oldRow, oldCol) -      self.updateCell(self.curRow, self.curCol) - -  def keyPressEvent(self, ke): -    oldRow = self.curRow -    oldCol = self.curCol -    edge = 0 -    key = ke.key() -    if key == Key_Left: -      if self.curCol > 0: -        self.curCol = self.curCol - 1 -        edge = self.leftCell() -        if self.curCol < edge: -          self.setLeftCell(edge-1) -    elif key == Key_Right: -      if self.curCol < self.numCols()-1: -        self.curCol = self.curCol + 1 -        edge = self.lastColVisible() -        if self.curCol >= edge: -          self.setLeftCell(self.leftCell()+1) -    elif key == Key_Up: -      if self.curRow > 0: -        self.curRow = self.curRow - 1 -        edge = self.topCell() -        if self.curRow < edge: -          self.setTopCell(edge-1) -    elif key == Key_Down: -      if self.curRow < self.numRows()-1: -        self.curRow = self.curRow + 1 -        edge = self.lastRowVisible() -        if self.curRow >= edge: -          self.setTopCell(self.topCell()+1) -    else: -      ke.ignore() -      return -     -    if self.curRow != oldRow or \ -       self.curCol != oldCol: -      self.updateCell(oldRow, oldCol) -      self.updateCell(self.curRow, self.curCol) - -  def focusInEvnet(self, fie): -    self.updateCell(self.curRow, self.curCol) - -  def focusOutEvent(self, foe): -    self.updateCell(self.curRow, self.curCol) - -  def indexOf(self, row, col): -    return (row * self.numCols()) + col - -numRows = 20 -numCols = 20 -a = TQApplication(sys.argv) -v = Table(numRows, numCols) -for i in range(numRows): -  for j in range(numCols): -    v.setCellContent(i,j,'%d %c' % (j, 65+(i%26))) -a.setMainWidget(v) -v.show() -a.exec_loop() | 
