本文整理汇总了Python中spyderlib.qt.QtGui.QToolTip.showText方法的典型用法代码示例。如果您正苦于以下问题:Python QToolTip.showText方法的具体用法?Python QToolTip.showText怎么用?Python QToolTip.showText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyderlib.qt.QtGui.QToolTip
的用法示例。
在下文中一共展示了QToolTip.showText方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_warning
# 需要导入模块: from spyderlib.qt.QtGui import QToolTip [as 别名]
# 或者: from spyderlib.qt.QtGui.QToolTip import showText [as 别名]
def update_warning(self):
""" """
widget = self._button_warning
if not self.is_valid():
tip = _('Array dimensions not valid')
widget.setIcon(ima.icon('MessageBoxWarning'))
widget.setToolTip(tip)
QToolTip.showText(self._widget.mapToGlobal(QPoint(0, 5)), tip)
else:
self._button_warning.setToolTip('')
示例2: show_calltip
# 需要导入模块: from spyderlib.qt.QtGui import QToolTip [as 别名]
# 或者: from spyderlib.qt.QtGui.QToolTip import showText [as 别名]
def show_calltip(self, title, text, signature=False, color='#2D62FF',
at_line=None, at_position=None):
"""Show calltip"""
if text is None or len(text) == 0:
return
# Saving cursor position:
if at_position is None:
at_position = self.get_position('cursor')
self.calltip_position = at_position
# Preparing text:
if signature:
text, wrapped_textlines = self._format_signature(text)
else:
if isinstance(text, list):
text = "\n ".join(text)
text = text.replace('\n', '<br>')
if len(text) > self.calltip_size:
text = text[:self.calltip_size] + " ..."
# Formatting text
font = self.font()
size = font.pointSize()
family = font.family()
format1 = '<div style=\'font-family: "%s"; font-size: %spt; color: %s\'>'\
% (family, size, color)
format2 = '<div style=\'font-family: "%s"; font-size: %spt\'>'\
% (family, size-1 if size > 9 else size)
tiptext = format1 + ('<b>%s</b></div>' % title) + '<hr>' + \
format2 + text + "</div>"
# Showing tooltip at cursor position:
cx, cy = self.get_coordinates('cursor')
if at_line is not None:
cx = 5
cursor = QTextCursor(self.document().findBlockByNumber(at_line-1))
cy = self.cursorRect(cursor).top()
point = self.mapToGlobal(QPoint(cx, cy))
point.setX(point.x()+self.get_linenumberarea_width())
point.setY(point.y()+font.pointSize()+5)
if signature:
self.calltip_widget.show_tip(point, tiptext, wrapped_textlines)
else:
QToolTip.showText(point, tiptext)
示例3: update_warning
# 需要导入模块: from spyderlib.qt.QtGui import QToolTip [as 别名]
# 或者: from spyderlib.qt.QtGui.QToolTip import showText [as 别名]
def update_warning(self, reset=False):
""" """
conflicts = self.check_conflicts()
if reset:
conflicts = []
widget = self.helper_button
if conflicts:
tip_title = _('The new entered shorcut conflicts with:') + '\n'
tip_body = ''
for s in conflicts:
tip_body += ' - {0}: {1}\n'.format(s.context, s.name)
tip = '{0}{1}'.format(tip_title, tip_body)
widget.setIcon(get_std_icon('MessageBoxWarning'))
widget.setToolTip(tip)
QToolTip.showText(widget.mapToGlobal(QPoint(0, 5)), tip)
else:
widget.setToolTip('')
QToolTip.hideText()
widget.setIcon(get_std_icon('DialogApplyButton'))
示例4: show_tip
# 需要导入模块: from spyderlib.qt.QtGui import QToolTip [as 别名]
# 或者: from spyderlib.qt.QtGui.QToolTip import showText [as 别名]
def show_tip(self, tip=""):
"""Show tip"""
QToolTip.showText(self.mapToGlobal(self.pos()), tip, self)
示例5: mouseReleaseEvent
# 需要导入模块: from spyderlib.qt.QtGui import QToolTip [as 别名]
# 或者: from spyderlib.qt.QtGui.QToolTip import showText [as 别名]
def mouseReleaseEvent(self, event):
QToolTip.showText(self.mapToGlobal(QPoint(0, self.height())),
self._tip_text)
示例6: mouseReleaseEvent
# 需要导入模块: from spyderlib.qt.QtGui import QToolTip [as 别名]
# 或者: from spyderlib.qt.QtGui.QToolTip import showText [as 别名]
def mouseReleaseEvent(self, event):
""" """
QToolTip.showText(self.mapToGlobal(QPoint(0, 0)), self._tip_text)