On Sat, 30 Nov 2013 09:39:40 -0800
Segundo Bob <[email protected]> wrote:

> On 11/30/2013 07:55 AM, Terry Brown wrote:
> > Apparently Qt doesn't support tooltips for menu *items*
> > http://qt-project.org/forums/viewthread/8663
> 
> Perhaps that forum thread is about a Qt Designer limitation, not a PyQt4
> limitation.  Perhaps, it is out of date.
> 
> Tooltips on menu items works for me.  Here are is the relevant code
> excerpted from my program:

Ok, thanks - I would say you're code implements tooltips for menus
because menus don't support it themselves, you're building the tooltip
from basic parts, rather than just setting the tooltip text and letting
Qt do the work.  But, it's a solution, so cool.  I guess I'll try it, I
think you very rarely see tooltips on menu items, maybe I'm wrong, but
I haven't noticed them much.

Cheers -Terry

> ------
> self._menuSpecial = QtGui.QMenu(self)
> self.connect(self._menuSpecial, QtCore.SIGNAL("hovered(QAction *)"),
>     self._actionHovered)
> 
> actTDL = QtGui.QAction('&Show defaults', self._menuSpecial)
> actTDL.setToolTip('Show all control parameter defaults.')
> self._menuSpecial.connect(actTDL,
>              Qt.SIGNAL("activated()"),
>              lambda : self._callController(Cpolima.VcC_ShowDefaults))
> self._menuSpecial.addAction(actTDL)
> ------
> 
> def _actionHovered(self, action):
>     """ Cursor hovering over a context menu item.
>     """
> 
>     tip = action.toolTip()
>     QtGui.QToolTip.showText(QtGui.QCursor.pos(), tip)
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to