[PyQt] tooltips in menu: how?

"V. Armando Solé" sole at esrf.fr
Fri Apr 17 20:25:45 BST 2009


Andreas Pakulat wrote:
> On 17.04.09 19:57:29, "V. Armando Solé" wrote:
>   
>> Hi!
>>
>> I encounter the same problem as the original poster. The tooltips of  
>> QActions in a QMenu are not shown.
>>
>> Is there a solution?
>>     
>
> You can set the statustip on the actions, which makes the text show up
> in the statusbar (at least in KDE apps, maybe pure Qt needs some
> additional hookup there). But AFAIK Qt simply doesn't support Tooltips
> on menus at this point, possibly something they could add to 4.6.
>
> Andreas
I get satisfactory results (if one does not mind to show ALWAYS a 
tooltip) with:

            qt.QObject.connect(menu, qt.SIGNAL("hovered(QAction *)"), 
self._actionHovered)

    def _actionHovered(self, action):
        tip = action.toolTip()
        qt.QToolTip.showText(qt.QCursor.pos(), tip)

Surely there are cleaner workarounds ...

Armando




More information about the PyQt mailing list