當前位置: 首頁>>代碼示例>>Python>>正文


Python QtGui.QStandardItemModel方法代碼示例

本文整理匯總了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())); 
開發者ID:shaise,項目名稱:FreeCAD_FastenersWB,代碼行數:18,代碼來源:CountersunkHoles.py

示例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 
開發者ID:shaise,項目名稱:FreeCAD_FastenersWB,代碼行數:9,代碼來源:CountersunkHoles.py

示例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) 
開發者ID:DroidTest,項目名稱:TimeMachine,代碼行數:36,代碼來源:xrefwindow.py

示例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) 
開發者ID:DroidTest,項目名稱:TimeMachine,代碼行數:40,代碼來源:stringswindow.py

示例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)) 
開發者ID:ahmidou,項目名稱:Fabric-RBF,代碼行數:6,代碼來源:CanvasRbfEditor.py

示例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)) 
開發者ID:DrHibbitts,項目名稱:TiltBrushConverter,代碼行數:10,代碼來源:CustomQtWidgets.py


注:本文中的PySide.QtGui.QStandardItemModel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。