本文整理匯總了Python中PySide.QtCore.QAbstractTableModel類的典型用法代碼示例。如果您正苦於以下問題:Python QAbstractTableModel類的具體用法?Python QAbstractTableModel怎麽用?Python QAbstractTableModel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了QAbstractTableModel類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
def __init__(self, runner=None):
_OptionsModelMixin.__init__(self)
QAbstractTableModel.__init__(self)
self._runner = runner
def _column0(runner, options):
return str(options)
def _column1(runner, options):
STATE_ICONS = \
{LocalRunner.STATE_QUEUED: getIcon('media-playback-pause'),
LocalRunner.STATE_RUNNING: getIcon('media-playback-start'),
LocalRunner.STATE_SIMULATED: getIcon('face-smile'),
LocalRunner.STATE_ERROR: getIcon('face-sad')}
try:
return STATE_ICONS.get(runner.options_state(options))
except KeyError:
return None
def _column2(runner, options):
try:
progress = runner.options_progress(options) * 100
except KeyError:
progress = 0.0
return '{0:n}%'.format(progress)
def _column3(runner, options):
try:
return runner.options_status(options)
except KeyError:
return ''
self._data_getter = {0: _column0, 1: _column1, 2: _column2, 3: _column3}
示例2: __init__
def __init__(self, results, headerdata, parent=None, *args):
""" datain: a list of lists
headerdata: a list of strings
"""
QAbstractTableModel.__init__(self, parent, *args)
#self.arraydata = datain
self.headerdata = headerdata
self.results = results
示例3: __init__
def __init__(self, dataset = Dataset(), parent = None):
'''Construtor de DatasetModel.
Parâmetros:
dataset : objeto Dataset para ser atribuído a *_dataset*
'''
QAbstractTableModel.__init__(self, parent)
self._dataset = dataset
示例4: flags
def flags(self, index):
if not index.isValid():
return Qt.ItemIsEnabled
# If the column is the vary parameter then we want the user to be able to check/uncheck the box
if index.column() == 1:
return Qt.ItemFlags(QAbstractTableModel.flags(self, index) | Qt.ItemIsSelectable | Qt.ItemIsUserCheckable)
return Qt.ItemFlags(QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)
示例5: __init__
def __init__(self):
""" Build the Transactions Table """
QAbstractTableModel.__init__(self)
self.columns = self.getColumns()
self.roleResponses = {Qt.DisplayRole:self.getData,
Qt.EditRole:self.getData,
Qt.ToolTipRole:self.getTip,
Qt.StatusTipRole:self.getTip,
Qt.TextAlignmentRole:self.getTextAlignment}
示例6: __init__
def __init__ ( self, editor, parent ):
""" Initialise the object.
"""
QAbstractTableModel.__init__( self, parent )
self.setSupportedDragActions( Qt.CopyAction | Qt.MoveAction )
self._editor = editor
self._row = editor.data_row_for
self._font = set()
示例7: __init__
def __init__(self, dados = [], parent = None):
'''Construtor de DatasetModel.
Parâmetros:
dados : objeto Dataset para ser atribuído a *_dataset*
'''
QAbstractTableModel.__init__(self, parent)
self._dados = dados
self._estatistica = dados.describe()
示例8: __init__
def __init__(self, tabList=None, parent=None):
QAbstractTableModel.__init__(self, parent)
self.__headers = [
'Char', 'Freq', 'ASCII', 'Huff', u'Ĉ ASCII', u'Ĉ Huff']
if tabList is None:
tabList = [['' for x in range(len(self.__headers))]]
for x in range(len(tabList)):
missingCols = len(self.__headers) - len(tabList[x])
for x in range(missingCols):
tabList[x].append('/')
self.__tabList = tabList
self.hlRow = []
示例9: flags
def flags(self, index):
""" Define editable cells
:param index:
"""
if not index.isValid():
return Qt.ItemIsEnabled
if index.column() in [NODE_NAME, NODE_FILE]:
return Qt.ItemFlags(
QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)
return Qt.ItemFlags(QAbstractTableModel.flags(self, index))
示例10: mimeTypes
def mimeTypes ( self ):
""" Returns the set of mime types that drag data can be encoded in.
"""
result = QAbstractTableModel.mimeTypes( self )
result.append( PythonMimeType )
return result
示例11: flagsRule
def flagsRule(self, index):
row = index.row()
if (index.column() == COLUMN.VALUE and
(row == RULE_ROW.NAME or row == RULE_ROW.VARIABLE or row == RULE_ROW.MATH)):
return Qt.ItemFlags(QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)
else:
return None
示例12: flagsGeneral
def flagsGeneral(self, index):
row = index.row()
if index.column() == COLUMN.VALUE and row == 1: # 1 is hardcoded; "Name" always has to be at 2nd position
return Qt.ItemFlags(QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)
else:
#return Qt.ItemFlags(QAbstractTableModel.flags(self, index))
return None
示例13: flagsEvent
def flagsEvent(self, index):
row = index.row()
if (index.column() == COLUMN.VALUE and
(row == EVENT_ROW.NAME or row == EVENT_ROW.TARGET or row == EVENT_ROW.EXPRESSION or row == EVENT_ROW.TRIGGEREXPRESSION)):
return Qt.ItemFlags(QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)
else:
return None
示例14: flags
def flags(self, index):
""" Set the item flags at the given index. Seems like we're
implementing this function just to see how it's done, as we
manually adjust each tableView to have NoEditTriggers.
"""
if not index.isValid():
return Qt.ItemIsEnabled
return Qt.ItemFlags(QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)
示例15: setData
def setData ( self, index, value, role ):
""" Reimplemented to allow setting data.
"""
if role == Qt.EditRole:
# This works because a Facets Editor will have already set the value
# on the object, and so we don't need to do anything here:
return True
return QAbstractTableModel.setData( self, index, value, role )