本文整理汇总了Python中PyQt5.Qt.QTreeWidgetItem.setStatusTip方法的典型用法代码示例。如果您正苦于以下问题:Python QTreeWidgetItem.setStatusTip方法的具体用法?Python QTreeWidgetItem.setStatusTip怎么用?Python QTreeWidgetItem.setStatusTip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.Qt.QTreeWidgetItem
的用法示例。
在下文中一共展示了QTreeWidgetItem.setStatusTip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_item
# 需要导入模块: from PyQt5.Qt import QTreeWidgetItem [as 别名]
# 或者: from PyQt5.Qt.QTreeWidgetItem import setStatusTip [as 别名]
def create_item(name, linear=None):
imt = container.mime_map.get(name, guess_type(name))
icat = get_category(name, imt)
category = "text" if linear is not None else ({"text": "misc"}.get(icat, icat))
item = QTreeWidgetItem(self.categories["text" if linear is not None else category], 1)
flags = Qt.ItemIsEnabled | Qt.ItemIsSelectable
if category == "text":
flags |= Qt.ItemIsDragEnabled
if name not in cannot_be_renamed:
flags |= Qt.ItemIsEditable
item.setFlags(flags)
item.setStatusTip(0, _("Full path: ") + name)
item.setData(0, NAME_ROLE, name)
item.setData(0, CATEGORY_ROLE, category)
item.setData(0, LINEAR_ROLE, bool(linear))
item.setData(0, MIME_ROLE, imt)
set_display_name(name, item)
tooltips = []
emblems = []
if name in {cover_page_name, cover_image_name}:
emblems.append("default_cover.png")
tooltips.append(
_("This file is the cover %s for this book")
% (_("image") if name == cover_image_name else _("page"))
)
if name in container.opf_name:
emblems.append("metadata.png")
tooltips.append(_("This file contains all the metadata and book structure information"))
if imt == ncx_mime or name in nav_items:
emblems.append("toc.png")
tooltips.append(_("This file contains the metadata table of contents"))
if name not in manifested_names and not container.ok_to_be_unmanifested(name):
emblems.append("dialog_question.png")
tooltips.append(_("This file is not listed in the book manifest"))
if linear is False:
emblems.append("arrow-down.png")
tooltips.append(
_("This file is marked as non-linear in the spine\nDrag it to the top to make it linear")
)
if linear is None and icat == "text":
# Text item outside spine
emblems.append("dialog_warning.png")
tooltips.append(_("This file is a text file that is not referenced in the spine"))
if category == "text" and name in processed:
# Duplicate entry in spine
emblems.append("dialog_error.png")
tooltips.append(_("This file occurs more than once in the spine"))
render_emblems(item, emblems)
if tooltips:
item.setData(0, Qt.ToolTipRole, "\n".join(tooltips))
return item