本文整理汇总了Python中spyderlib.qt.QtGui.QTreeWidgetItem.setToolTip方法的典型用法代码示例。如果您正苦于以下问题:Python QTreeWidgetItem.setToolTip方法的具体用法?Python QTreeWidgetItem.setToolTip怎么用?Python QTreeWidgetItem.setToolTip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyderlib.qt.QtGui.QTreeWidgetItem
的用法示例。
在下文中一共展示了QTreeWidgetItem.setToolTip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: populate_tree
# 需要导入模块: from spyderlib.qt.QtGui import QTreeWidgetItem [as 别名]
# 或者: from spyderlib.qt.QtGui.QTreeWidgetItem import setToolTip [as 别名]
def populate_tree(self, parentItem, children_list):
"""Recursive method to create each item (and associated data) in the tree."""
for child_key in children_list:
self.item_depth += 1
(filename, line_number, function_name, file_and_line, node_type
) = self.function_info(child_key)
(primcalls, total_calls, loc_time, cum_time, callers
) = self.stats[child_key]
child_item = QTreeWidgetItem(parentItem)
self.item_list.append(child_item)
self.set_item_data(child_item, filename, line_number)
# FIXME: indexes to data should be defined by a dictionary on init
child_item.setToolTip(0, 'Function or module name')
child_item.setData(0, Qt.DisplayRole, function_name)
child_item.setIcon(0, get_icon(self.icon_list[node_type]))
child_item.setToolTip(1, _('Time in function '\
'(including sub-functions)'))
#child_item.setData(1, Qt.DisplayRole, cum_time)
child_item.setData(1, Qt.DisplayRole, '%.3f' % cum_time)
child_item.setTextAlignment(1, Qt.AlignCenter)
child_item.setToolTip(2, _('Local time in function '\
'(not in sub-functions)'))
#child_item.setData(2, Qt.DisplayRole, loc_time)
child_item.setData(2, Qt.DisplayRole, '%.3f' % loc_time)
child_item.setTextAlignment(2, Qt.AlignCenter)
child_item.setToolTip(3, _('Total number of calls '\
'(including recursion)'))
child_item.setData(3, Qt.DisplayRole, total_calls)
child_item.setTextAlignment(3, Qt.AlignCenter)
child_item.setToolTip(4, _('File:line '\
'where function is defined'))
child_item.setData(4, Qt.DisplayRole, file_and_line)
#child_item.setExpanded(True)
if self.is_recursive(child_item):
child_item.setData(4, Qt.DisplayRole, '(%s)' % _('recursion'))
child_item.setDisabled(True)
else:
callees = self.find_callees(child_key)
if self.item_depth < 3:
self.populate_tree(child_item, callees)
elif callees:
child_item.setChildIndicatorPolicy(child_item.ShowIndicator)
self.items_to_be_shown[id(child_item)] = callees
self.item_depth -= 1