本文整理汇总了Python中PyQt5.QtGui.QStandardItem.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python QStandardItem.setEnabled方法的具体用法?Python QStandardItem.setEnabled怎么用?Python QStandardItem.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui.QStandardItem
的用法示例。
在下文中一共展示了QStandardItem.setEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addBackends
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setEnabled [as 别名]
def addBackends(self, cap=None, entry_all=True, entry_title=False):
"""
Populate the model by adding backends.
Appends backends to the model, without clearing previous entries.
For each entry in the model, the cap name is stored under role
RoleBackendName and the capability object under role
RoleCapability.
:param cap: capabilities to add (None to add all loaded caps)
:param entry_all: if True, add a "All backends" entry
:param entry_title: if True, add a disabled entry with the cap name
"""
if entry_title:
if cap:
capname = cap.__name__
else:
capname = '(All capabilities)'
item = QStandardItem(capname)
item.setEnabled(False)
self.appendRow(item)
first = True
for backend in self.weboob.iter_backends(caps=cap):
if first and entry_all:
item = QStandardItem('(All backends)')
item.setData('', self.RoleBackendName)
item.setData(cap, self.RoleCapability)
self.appendRow(item)
first = False
item = QStandardItem(backend.name)
item.setData(backend.name, self.RoleBackendName)
item.setData(cap, self.RoleCapability)
minfo = self.weboob.repositories.get_module_info(backend.NAME)
icon_path = self.weboob.repositories.get_module_icon_path(minfo)
if icon_path:
pixmap = QPixmapCache.find(icon_path)
if not pixmap:
pixmap = QPixmap(QImage(icon_path))
item.setIcon(QIcon(pixmap))
self.appendRow(item)
示例2: fill_tree
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setEnabled [as 别名]
def fill_tree(self, children: List[FsFileInfo]) -> None:
self.item.removeRows(0, self.item.rowCount())
for child in self.tree.sort_children(children):
subitem = QStandardItem(child.get_label())
if child.checkable():
subitem.setCheckable(True)
subitem.setCheckState(True)
subitem.setTristate(True)
subitem.setCheckState(child.state)
subitem.setEnabled(child.enable())
subitem.setSelectable(child.selectable())
subitem.setEditable(False)
subitem.setData(QVariant(child), Qt.UserRole)
if child.folderish():
# Add "Loading..." entry in advance for when the user
# will click to expand it.
loaditem = QStandardItem(Translator.get("LOADING"))
loaditem.setSelectable(False)
subitem.appendRow(loaditem)
self.item.appendRow(subitem)