本文整理汇总了Python中PyQt4.QtCore.QAbstractItemModel类的典型用法代码示例。如果您正苦于以下问题:Python QAbstractItemModel类的具体用法?Python QAbstractItemModel怎么用?Python QAbstractItemModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QAbstractItemModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__( self, parent = None ):
QAbstractItemModel.__init__( self, parent )
self.rootItem = FileItemRoot( [ "File name", "Full path" ] )
self.count = 0
self.__populateModel()
return
示例2: __init__
def __init__(self,
parent=None,
rootNode=None,
horizontalHeaders=None,
verticalHeaders=None,
defaultNode=None):
"""
Initializes the class.
:param parent: Object parent.
:type parent: QObject
:param rootNode: Root node.
:type rootNode: AbstractCompositeNode or GraphModelNode
:param horizontalHeaders: Headers.
:type horizontalHeaders: OrderedDict
:param verticalHeaders: Headers.
:type verticalHeaders: OrderedDict
:param defaultNode: Default node.
:type defaultNode: AbstractCompositeNode or GraphModelNode
"""
LOGGER.debug("> Initializing '{0}()' class.".format(self.__class__.__name__))
QAbstractItemModel.__init__(self, parent)
# --- Setting class attributes. ---
self.__rootNode = None
self.rootNode = rootNode or umbra.ui.nodes.DefaultNode(name="InvisibleRootNode")
self.__horizontalHeaders = None
self.horizontalHeaders = horizontalHeaders or OrderedDict([("Graph Model", "graphModel")])
self.__verticalHeaders = None
self.verticalHeaders = verticalHeaders or OrderedDict()
self.__defaultNode = None
self.defaultNode = defaultNode or umbra.ui.nodes.GraphModelNode
示例3: __init__
def __init__(self, parentObject):
QAbstractItemModel.__init__(self, parentObject )
self._sortMode = core.config()["Workspace"]["FileSortMode"]
self._workspace = parentObject.parent()
self._workspace.documentOpened.connect(self._onDocumentOpened)
self._workspace.documentClosed.connect(self._onDocumentClosed)
self._workspace.modificationChanged.connect(self._onDocumentDataChanged)
示例4: __init__
def __init__(self, library):
QAbstractItemModel.__init__(self)
self.file_icon = QIcon(auxilia.PIcon('audio-x-generic'))
self.dir_icon = QIcon(auxilia.PIcon('folder-sound'))
self.cache = {}
self.library = library
self.root = mpdlibrary.Dir('', self.library)
示例5: __init__
def __init__(self, controller, distributed_objects, parent = None):
""" Constructor <br>
Create a VariableModel derived from an QAbstractItemModel to display the <br>
GDB variables in a treeview.<br>
Listens to the following Signals: SignalProxy::inferiorHasStopped(PyQt_PyObject) <br>
SignalProxy::inferiorHasExited(PyQt_PyObject) and <br>
SignalProxy::executableOpened()
@param controller controllers.WatchController, Reference to the WatchController
@param distributedObjects distributedobjects.DistributedObjects, the DistributedObjects-Instance
@param parent parent for the QAbstractItemModel-Constructor, can be None
"""
QAbstractItemModel.__init__(self, parent)
self.distributedObjects = distributed_objects
self.controller = controller
## @var root
# RootVarWrapper, root item of tree
self.root = RootVarWrapper()
## images:
self.imgStruct = QPixmap(":/icons/images/struct.png")
self.imgFake = QPixmap(":/icons/images/fake_entry.png")
self.imgVariable = QPixmap(":/icons/images/var.png")
self.imgEdit = QPixmap(":/icons/images/edit.png")
self.imgOutOfScope = QPixmap(":/icons/images/outofscope.png")
#connects
QObject.connect(self.distributedObjects.signal_proxy, SIGNAL('inferiorHasStopped(PyQt_PyObject)'), self.update)
QObject.connect(self.distributedObjects.signal_proxy, SIGNAL('inferiorHasExited(PyQt_PyObject)'), self.clear)
QObject.connect(self.distributedObjects.signal_proxy, SIGNAL('executableOpened()'), self.clear)
示例6: __init__
def __init__(self, __parent = None):
"""
Constructor.
"""
QAbstractItemModel.__init__(self, __parent)
# init root + some values
self.rootItem = None
self.__parent = __parent
self.connect(self.__parent, SIGNAL("NewSearch"), self.clean)
self.VFS = VFS.Get()
self.map = {}
self.imagesthumbnails = None
self.connect(self, SIGNAL("dataImage"), self.setDataImage)
self.translation()
self.fetchedItems = 0
self.thumbQueued = {}
self.checkedNodes = set()
# those list contains nodes' children of the currently selcted node.
self.node_list = []
# list of headers the user choosed to display.
self.header_list = []
self.type_list = []
self.disp_module = 0
self.del_sort = 0
self.cacheAttr = (None, None)
示例7: __init__
def __init__(self, ert):
"""
@type ert: ert.enkf.EnKFMain
"""
QAbstractItemModel.__init__(self)
self.__ert = ert
self.__icon = util.resourceIcon("ide/small/bullet_star")
示例8: __init__
def __init__(self, parent ):
"""Constructor of SearchResultsModel class
"""
QAbstractItemModel.__init__(self, parent )
self._replaceMode = False
self.fileResults = [] # list of FileResults
示例9: __init__
def __init__(self, tree_instance):
""" Inititalizes tree model and super class.
"""
QAbstractItemModel.__init__(self)
self._treeRoot = tree_instance
self._treeRoot.signal_tree_data_changed.connect(self.fire_model_changed)
示例10: __init__
def __init__( self, parent = None ):
QAbstractItemModel.__init__( self, parent )
self.rootItem = NameItem( None, None, "Name", "", "", "" )
self.count = 0
self.showTooltips = Settings().findNameTooltips
self.__populateModel()
return
示例11: __init__
def __init__( self, headerData, parent = None ):
QAbstractItemModel.__init__( self, parent )
self.rootItem = TreeViewItem( None, headerData )
self.globalData = GlobalData()
self.projectTopLevelDirs = []
self.showTooltips = True
return
示例12: __init__
def __init__(self, data, parent = None):
QAbstractItemModel.__init__(self, parent)
self._data = data
self._table = []
self._tableR = {}
self._headers = ['file','confidence']
self._headersR = { v:i for i,v in enumerate(self._headers) }
self._update(self._data)
示例13: __init__
def __init__(self, mpdclient, library):
QAbstractItemModel.__init__(self)
self.mpdclient = mpdclient
self.library = library
self._playlists = {}
self._names = []
self._dates = {}
self.connect(self, SIGNAL("loadPlaylist"), self._loadPlaylist)
self.connect(self, SIGNAL("updatePlaylist"), self._updatePlaylist)
示例14: setHeaderData
def setHeaderData(self, section, orientation, value, role):
"""
\reimp
Add a header data into the header. Emit a `layoutAboutToBeChanged` signal before adding the header
and `layoutChanged` once it is done.
"""
self.emit(SIGNAL("layoutAboutToBeChanged()"))
QAbstractItemModel.setHeaderData(self, section, orientation, value, role)
self.emit(SIGNAL("layoutChanged()"))
示例15: __init__
def __init__(self, data, header, parent):
QAbstractItemModel.__init__(self, parent)
self._data = data
self._dataDict = {}
self._header = header
self._roleData = {Qt.DisplayRole: self._data}
self._roleData = partial(
defaultdict,
partial(defaultdict,
partial(defaultdict, lambda: None)))(self._roleData)