1

I have a c++ Qt application where I want to display tooltips for some QActions in a QMenu.

Since Qt 5.1, there's the toolTipsVisible property, which I set it to true in my .ui file but this doesn't display any tooltips when I run my application (even though the tooltips are displayed when I hover the QActions inside Qt Designer, just not when the application runs).

I couldn't test this on Windows, but I know some widgets behaves differently when used on Windows or on Mac, like QMessageBox not displaying titles on Mac, so maybe this tooltip issue is similar to this ?

Anyway, I then tried to subclass QMenu and reimplement the bool event(QEvent* e) function to handle tooltips manually. I used code similar to the one of the accepted answer of this question. I promoted my QMenu item to my subclass, but this doesn't work for me either, no tooltips displayed when hovering my QActions.

Is there anything I'm doing wrong here ?

This was tested on 2 setups :

  • Qt 5.6.1, OS X El Capitan

  • Qt 5.8.0, macOS Sierra

nmud
  • 175
  • 14
  • How do you set your tooltips? – vahancho Jul 12 '17 at 09:15
  • In the QAction property of my .ui file, I wrote a tooltip different than the text of the QAction, because by default the tooltip is the same as the text. – nmud Jul 12 '17 at 09:30
  • Possible duplicate of [QTooltip for QActions in QMenu](https://stackoverflow.com/questions/27161122/qtooltip-for-qactions-in-qmenu) – cbuchart Jul 12 '17 at 12:16
  • Duplicate I don't know, but this post is mentioned in my question and the accepted answer over there doesn't work for me. – nmud Jul 12 '17 at 12:28

0 Answers0