3 from PyQt4 import QtGui, QtCore
4 class QMenuToolTip(QtGui.QMenu):
5 """ Implements a QMenu where it is possible to set a ToolTip and display it on mouse hover """
6 def __init__(self, parent=None):
7 QtGui.QMenu.__init__(self, parent)
10 if e.type() == QtCore.QEvent.ToolTip:
11 if not self.activeAction() is None:
12 QtGui.QToolTip.showText(e.globalPos(), self.activeAction().toolTip())
14 QtGui.QToolTip.hideText()
15 return QtGui.QMenu.event(self, e)