本文整理汇总了Python中PyQt5.QtWidgets.QToolTip.showText方法的典型用法代码示例。如果您正苦于以下问题:Python QToolTip.showText方法的具体用法?Python QToolTip.showText怎么用?Python QToolTip.showText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QToolTip
的用法示例。
在下文中一共展示了QToolTip.showText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mouseMoveEvent
# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import showText [as 别名]
def mouseMoveEvent(self, event):
position = self.mapFromGlobal(event.globalPos())
key = (position.y() // self.cellSize) * self.columns + position.x() // self.cellSize
text = '<p>Character: <span style="font-size: 24pt; font-family: %s">%s</span><p>code: %d' % (
self.displayFont.family(), self._chr(key), key+32)
QToolTip.showText(event.globalPos(), text, self)
示例2: event
# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import showText [as 别名]
def event(self, ev):
if ev.type() == QEvent.ToolTip:
if self._showToolTips:
c = self.charcodeAt(ev.pos())
if c:
text = self.getToolTipText(c)
if text:
rect = self.charcodeRect(c)
QToolTip.showText(ev.globalPos(), text, self, rect)
ev.accept()
return True
elif ev.type() == QEvent.QueryWhatsThis:
if self._showWhatsThis:
ev.accept()
return True
elif ev.type() == QEvent.WhatsThis:
ev.accept()
if self._showWhatsThis:
c = self.charcodeAt(ev.pos())
text = self.getWhatsThisText(c) if c else None
if text:
QWhatsThis.showText(ev.globalPos(), text, self)
else:
QWhatsThis.leaveWhatsThisMode()
return True
return super(CharMap, self).event(ev)
示例3: mouseMoveEvent
# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import showText [as 别名]
def mouseMoveEvent(self, event):
super().mouseMoveEvent(event)
# tooltip_position = event.globalPos() - QPoint(event.pos().x(), 0)
from_line = self._neditor.first_visible_block().blockNumber() + 1
to_line = self._neditor.last_visible_block().blockNumber()
text = "<center>%d<br/>—<br/>%d</center>"
QToolTip.showText(self._tooltip_pos, text % (from_line, to_line))
示例4: mouseMoveEvent
# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import showText [as 别名]
def mouseMoveEvent(self, event):
cursor = self._neditor.cursorForPosition(event.pos())
line = cursor.blockNumber()
bookmarks = self._bookmark_manager.bookmarks(self._neditor.file_path)
for book in bookmarks:
if book.lineno == line and book.note:
QToolTip.showText(self.mapToGlobal(event.pos()), book.note)
示例5: verifier_feuille
# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import showText [as 别名]
def verifier_feuille(self, eq1, eq2):
print(eq1, eq2)
for nom, eq in (('d1', eq1), ('d2', eq2)):
if nom in self.feuille_actuelle.objets.noms:
d = self.feuille_actuelle.objets[nom]
d.label(mode='nom')
champ = self.feuille_actuelle.objets['champcache_' + nom]
M, N = d
M = (int(M.x), int(M.y))
N = (int(N.x), int(N.y))
if self.eq_reduite(M, N) == eq:
d.style(couleur='g')
champ.texte = 'ok'
msg = 'La droite %s est correcte.' % nom
if nom == 'd1':
msg += ' Construisez maintenant d2.'
else:
print(self.eq_reduite(*d), eq)
d.style(couleur='r')
# On peut mettre n'importe quoi différent de ok dans
# champ, l'idée étant que si la droite est fausse mais
# n'a pas changé, on ne perde pas de point, et par
# contre on perde des points en cas de changement si
# c'est toujours faux.
champ.texte = str(d.equation)
msg = "Attention, la droite %s est fausse." % nom
QToolTip.showText(QCursor.pos(), msg)
self.canvas.message(msg, temporaire=False)
示例6: moved
# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import showText [as 别名]
def moved(self, pos):
with self.lock:
fee_rate = self.config.dynfee(pos) if self.dyn else self.config.static_fee(pos)
tooltip = self.get_tooltip(pos, fee_rate)
QToolTip.showText(QCursor.pos(), tooltip, self)
self.setToolTip(tooltip)
self.callback(self.dyn, pos, fee_rate)
示例7: mousePressEvent
# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import showText [as 别名]
def mousePressEvent(self, event):
super().mousePressEvent(event)
if event.button() == Qt.LeftButton:
self._tooltip_pos = event.globalPos() - QPoint(event.pos().x(), 0)
from_line = self._neditor.first_visible_block().blockNumber() + 1
to_line = self._neditor.last_visible_block().blockNumber()
text = "<center>%d<br/>—<br/>%d</center>"
QToolTip.showText(self._tooltip_pos, text % (from_line, to_line))
示例8: event
# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import showText [as 别名]
def event(self, ev):
if ev.type() == QEvent.ToolTip:
text = self.defaultAction().text()
key = self.key()
if key:
text = _("{name} ({key})").format(name=text, key=key)
QToolTip.showText(ev.globalPos(), text)
return True
return super(Button, self).event(ev)
示例9: event
# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import showText [as 别名]
def event(self, e):
action = self.activeAction()
if e.type() == QEvent.ToolTip and \
action and \
action.toolTip() != action.text():
QToolTip.showText(e.globalPos(),
self.activeAction().toolTip())
else:
QToolTip.hideText()
return super(Menu, self).event(e)
示例10: linkHelpEvent
# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import showText [as 别名]
def linkHelpEvent(self, globalPos, page, link):
"""Called when a QHelpEvent occurs on a link.
The default implementation shows a tooltip if showUrls() is True,
and emits the linkHelpRequested() signal.
"""
if self._showUrlTips and isinstance(link, popplerqt5.Poppler.LinkBrowse):
QToolTip.showText(globalPos, link.url(), self, page.linkRect(link.linkArea()))
self.linkHelpRequested.emit(globalPos, page, link)
示例11: mouseMoveEvent
# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import showText [as 别名]
def mouseMoveEvent(self, event):
if not self.cross:
mouse_x = event.pos().x()
mouse_y = event.pos().y()
self.mouse_pos = event.pos()
if self.img != None:
rgb = QColor(self.img.pixel(self.mouse_pos))
text = "XY[" + str(mouse_x) + "," + str(mouse_y)+ "] RGB(" + str(rgb.red()) + "," + str(rgb.green()) + "," + str(rgb.blue()) + ")"
QToolTip.showText(QPoint(QCursor.pos()), text)
self.repaint()
示例12: moved
# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import showText [as 别名]
def moved(self, pos):
with self.lock:
if self.dyn:
fee_rate = self.config.depth_to_fee(pos) if self.config.use_mempool_fees() else self.config.eta_to_fee(pos)
else:
fee_rate = self.config.static_fee(pos)
tooltip = self.get_tooltip(pos, fee_rate)
QToolTip.showText(QCursor.pos(), tooltip, self)
self.setToolTip(tooltip)
self.callback(self.dyn, pos, fee_rate)
示例13: mouseMoveEvent
# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import showText [as 别名]
def mouseMoveEvent(self, event):
if not self.__checkers:
return
line = self._editor.line_from_position(event.pos().y())
for checker in self.__checkers:
obj, _, _ = checker
message = obj.message(line)
if message is not None:
# Formatting text
text = "<div style='color: green'>Lint</div><hr>%s" % message
QToolTip.showText(self.mapToGlobal(event.pos()), text, self)
示例14: event
# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import showText [as 别名]
def event(self, event):
if event.type() == QEvent.ToolTip:
helpEvent = event
index = self.itemAt(helpEvent.pos())
if index != -1:
QToolTip.showText(helpEvent.globalPos(), self.shapeItems[index].toolTip())
else:
QToolTip.hideText()
event.ignore()
return True
return super(SortingBox, self).event(event)
示例15: slotLinkHelpRequested
# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import showText [as 别名]
def slotLinkHelpRequested(self, pos, page, link):
"""Called when a ToolTip wants to appear above the hovered link."""
if isinstance(link, popplerqt5.Poppler.LinkBrowse):
cursor = self._links.cursor(link)
if cursor:
import documenttooltip
text = documenttooltip.text(cursor)
elif link.url():
l = textedit.link(link.url())
if l:
text = "{0} ({1}:{2})".format(os.path.basename(l.filename), l.line, l.column)
else:
text = link.url()
QToolTip.showText(pos, text, self.view.surface(), page.linkRect(link.linkArea()))