9 QAbstractTableModel.__init__(self, parent)
13 return len(self.
tabletable.rows)
16 if role!=Qt.DisplayRole
or orientation!=Qt.Horizontal:
18 return self.
tabletable.col_names[section]
21 return len(self.
tabletable.col_names)
23 def sort(self, column, order):
25 if order!=Qt.AscendingOrder:
27 self.
tabletable.Sort(by=self.
tabletable.col_names[column], order=o)
30 def data(self, index, role):
31 if not index.isValid()
or role!=Qt.DisplayRole:
33 row=self.
tabletable.rows[index.row()]
34 return QVariant(row[index.column()])
38 QTableView.__init__(self)
40 self.setFrameShape(QFrame.NoFrame)
41 self.setAttribute(Qt.WA_MacSmallSize)
42 self.setShowGrid(
False)
44 self.horizontalHeader().setStretchLastSection(
True)
45 self.setContextMenuPolicy(Qt.CustomContextMenu)
46 self.setSelectionBehavior(QAbstractItemView.SelectRows)
47 self.setSizePolicy(QSizePolicy.MinimumExpanding,
48 QSizePolicy.MinimumExpanding)
49 self.setSortingEnabled(
True)
50 self.setModel(self.
_model_model)
51 QObject.connect(self, SIGNAL(
'doubleClicked(QModelIndex)'),
def OnDoubleClick(self, model_index)
def __init__(self, table)
def sort(self, column, order)
def columnCount(self, index)
def data(self, index, role)
def headerData(self, section, orientation, role)
def __init__(self, table, parent=None)
def rowCount(self, index)