Python PySide.QtGui 模块,QStandardItem() 实例源码

我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用PySide.QtGui.QStandardItem()

项目:TiltBrushConverter    作者:DrHibbitts    | 项目源码 | 文件源码
def addItem(self, mitem, data=None, checked=False):
        item = QtGui.QStandardItem()
        item.setData(mitem, QtCore.Qt.DisplayRole)
        if data is not None:
            item.setData(data, QtCore.Qt.UserRole)
        item.setEditable(self.renameEnabled)
        item.setDropEnabled(False)
        item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
        item.setCheckState(QtCore.Qt.Unchecked if not checked else QtCore.Qt.Checked)
        # Can be used to store data linked to the name
        # item.setData(customData, QtCore.Qt.UserRole)
        self.item_list_model.appendRow(item)
        self.item_count += 1
项目:augment3D    作者:yulkang    | 项目源码 | 文件源码
def array_to_model(self, array):
        model = QtGui.QStandardItemModel()
        parentItem = model.invisibleRootItem()
        for ntuple in array:
            tag = ntuple[0]
            value = ntuple[1]
            if isinstance(value, dict):
                self.recurse_dic_to_item(value, parentItem)
            else:
                item = QtGui.QStandardItem(tag + str(value))
                parentItem.appendRow(item)
        return parentItem
项目:augment3D    作者:yulkang    | 项目源码 | 文件源码
def recurse_dic_to_item(self, dic, parent):
        for k in dic:
            v = dic[k]
            if isinstance(v, dict):
                item = QtGui.QStandardItem(k + ':' + str(v))
                parent.appendRow(self.recurse_dic_to_item(v, item))
            else:
                item = QtGui.QStandardItem(k + ': ' + str(v))
                parent.appendRow(item)
        return parent
项目:bids    作者:robertoostenveld    | 项目源码 | 文件源码
def array_to_model(self, array):
        model = QtGui.QStandardItemModel()
        parentItem = model.invisibleRootItem()
        for ntuple in array:
            tag = ntuple[0]
            value = ntuple[1]
            if isinstance(value, dict):
                self.recurse_dic_to_item(value, parentItem)
            else:
                item = QtGui.QStandardItem(tag + str(value))
                parentItem.appendRow(item)
        return parentItem
项目:bids    作者:robertoostenveld    | 项目源码 | 文件源码
def recurse_dic_to_item(self, dic, parent):
        for k in dic:
            v = dic[k]
            if isinstance(v, dict):
                item = QtGui.QStandardItem(k + ':' + str(v))
                parent.appendRow(self.recurse_dic_to_item(v, item))
            else:
                item = QtGui.QStandardItem(k + ': ' + str(v))
                parent.appendRow(item)
        return parent
项目:DroidWatcher    作者:suemi994    | 项目源码 | 文件源码
def __init__(self, parent=None, win=None, xrefs=None):
        super(XrefListView, self).__init__(parent)

        self.setMinimumSize(600, 400) #TODO: adjust window depending on text displayed
        self.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.mainwin = win
        self.parent = parent

        self.doubleClicked.connect(self.doubleClickedHandler)

        model = QtGui.QStandardItemModel(self)
        for x in xrefs:
            item = QtGui.QStandardItem(x)
            model.appendRow(item)
        self.setModel(model)
项目:DroidWatcher    作者:suemi994    | 项目源码 | 文件源码
def __init__(self, parent=None, win=None, xrefs=None):
        super(XrefListView, self).__init__(parent)

        self.setMinimumSize(600, 400) #TODO: adjust window depending on text displayed
        self.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.mainwin = win
        self.parent = parent

        self.doubleClicked.connect(self.doubleClickedHandler)

        model = QtGui.QStandardItemModel(self)
        for x in xrefs:
            item = QtGui.QStandardItem(x)
            model.appendRow(item)
        self.setModel(model)