本文整理汇总了Python中PySide.QtGui.QStandardItemModel方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QStandardItemModel方法的具体用法?Python QtGui.QStandardItemModel怎么用?Python QtGui.QStandardItemModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui
的用法示例。
在下文中一共展示了QtGui.QStandardItemModel方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setData
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QStandardItemModel [as 别名]
def setData(self, index, value, role = QtCore.Qt.EditRole):
#ok = QStandardItemModel::setData(index, value, role);
ok = super(FSDiameterModel, self).setData(index, value, role)
#if role == QtCore.Qt.CheckStateRole:
# self.toggleCheckState(index)
return ok
# connect(model, SIGNAL(toggleCheckState(const QModelIndex&)),
# this, SLOT(toggleCheckState(const QModelIndex&)));
# // timer for highlighting
# d->highlighttimer = new QTimer(this);
# d->highlighttimer->setSingleShot(true);
# connect(d->highlighttimer,SIGNAL(timeout()),
# this, SLOT(onHighlightEdges()));
示例2: flags
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QStandardItemModel [as 别名]
def flags(self, index):
#fl = QtGui.QStandardItemModel.flags(index)
fl = super(FSDiameterModel, self).flags(index)
if index.column() == 0:
#FreeCAD.Console.PrintLog(str(fl) + "\n")
fl = fl | QtCore.Qt.ItemIsUserCheckable
return fl
示例3: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QStandardItemModel [as 别名]
def __init__(self, parent=None, win=None, xrefs=None, headers=None):
super(XrefValueWindow, self).__init__(parent)
self.parent = parent
self.mainwin = win
self.xrefs = xrefs
self.headers = headers
self.reverse_strings = {}
self.proxyModel = QtGui.QSortFilterProxyModel()
self.proxyModel.setDynamicSortFilter(True)
self.model = QtGui.QStandardItemModel(len(self.xrefs), len(self.headers), self)
column = 0
for header in headers:
self.model.setHeaderData(column, QtCore.Qt.Horizontal, header)
column += 1
row = 0
for ref in xrefs:
for column in range(len(self.headers)):
self.model.setData(self.model.index(row, column, QtCore.QModelIndex()), "%s" % ref[column])
row += 1
self.proxyModel.setSourceModel(self.model)
self.setRootIsDecorated(False)
self.setAlternatingRowColors(True)
self.setModel(self.proxyModel)
self.setSortingEnabled(True)
self.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
self.doubleClicked.connect(self.slotDoubleClicked)
示例4: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QStandardItemModel [as 别名]
def __init__(self, parent=None, win=None, session=None):
super(StringsValueWindow, self).__init__(parent)
self.mainwin = win
self.session = session
self.title = "Strings"
self.reverse_strings = {}
self.proxyModel = QtGui.QSortFilterProxyModel()
self.proxyModel.setDynamicSortFilter(True)
self.model = QtGui.QStandardItemModel(self.session.get_nb_strings(), 4, self)
self.model.setHeaderData(0, QtCore.Qt.Horizontal, "String")
self.model.setHeaderData(1, QtCore.Qt.Horizontal, "Usage")
self.model.setHeaderData(2, QtCore.Qt.Horizontal, "Filename")
self.model.setHeaderData(3, QtCore.Qt.Horizontal, "Digest")
row = 0
for digest, filename, strings_analysis in self.session.get_strings():
for string_value in strings_analysis:
self.model.setData(self.model.index(row, 0, QtCore.QModelIndex()), repr(string_value))
self.model.setData(self.model.index(row, 1, QtCore.QModelIndex()), len(strings_analysis[string_value].get_xref_from()))
self.model.setData(self.model.index(row, 2, QtCore.QModelIndex()), filename)
self.model.setData(self.model.index(row, 3, QtCore.QModelIndex()), digest)
self.reverse_strings[repr(string_value) + digest] = strings_analysis[string_value]
row += 1
self.proxyModel.setSourceModel(self.model)
self.setRootIsDecorated(False)
self.setAlternatingRowColors(True)
self.setModel(self.proxyModel)
self.setSortingEnabled(True)
self.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
self.doubleClicked.connect(self.slotDoubleClicked)
示例5: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QStandardItemModel [as 别名]
def __init__(self):
super(CheckableComboBox, self).__init__()
self.view().pressed.connect(self.handleItemPressed)
self.setModel(QtGui.QStandardItemModel(self))
示例6: createWidgets
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QStandardItemModel [as 别名]
def createWidgets(self):
self.item_list_model = QtGui.QStandardItemModel(self)
self.item_list_model.setSortRole(QtCore.Qt.DisplayRole)
self.item_list_model.dataChanged.connect(self.handleDataChange)
self.setModel(self.item_list_model)
self.item_selection_model = self.selectionModel()
self.setMinimumHeight(60)
self.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred))