9 QAbstractTableModel.__init__(self, parent)
13 return len(self.table.rows)
16 if role!=Qt.DisplayRole
or orientation!=Qt.Horizontal:
18 return self.table.col_names[section]
21 return len(self.table.col_names)
23 def sort(self, column, order):
25 if order!=Qt.AscendingOrder:
27 self.table.Sort(by=self.table.col_names[column], order=o)
30 def data(self, index, role):
31 if not index.isValid()
or role!=Qt.DisplayRole:
33 row=self.table.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)
51 QObject.connect(self, SIGNAL(
'doubleClicked(QModelIndex)'),