Example #1
0
 def show_tooltip(self, evt: QHelpEvent) -> bool:
     assert isinstance(evt, QHelpEvent)
     for feat in self.features:
         if feat.rect.contains(evt.pos()):
             QToolTip.showText(evt.globalPos(), feat.tooltip())
             break
     else:
         QToolTip.hideText()
         evt.ignore()
     return True
Example #2
0
 def helpEvent(self, evt: QHelpEvent, view: QAbstractItemView, option: QStyleOptionViewItem, idx: QModelIndex) -> bool:
     custom_data = idx.data(MyTreeView.ROLE_CUSTOM_PAINT)
     if custom_data is None:
         return super().helpEvent(evt, view, option, idx)
     else:
         if evt.type() == QEvent.ToolTip:
             if custom_data.show_tooltip(evt):
                 return True
     return super().helpEvent(evt, view, option, idx)
Example #3
0
def show_tooltip(parent, widget):
    app.notify(widget, QHelpEvent(QHelpEvent.ToolTip, widget.pos(), parent.mapToGlobal(widget.pos())))