当前位置: 首页>>代码示例>>Python>>正文


Python QTreeWidgetItem.setStatusTip方法代码示例

本文整理汇总了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
开发者ID:Xliff,项目名称:calibre,代码行数:54,代码来源:file_list.py


注:本文中的PyQt5.Qt.QTreeWidgetItem.setStatusTip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。