Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED]Simple Widget ToolTips Not Working



  • Hello all,

    I have a Qt4.7 desktop application in development, and I can't seem to get tooltips to show up. I am trying to add tooltips to QToolButtons (that reside in a QGroupBox in a QTabWidget in a QDockWindow) by calling setToolTip() on the buttons. I have tried setting the Qt::WA_AlwaysShowToolTips attribute all the way up the hierarchy of widgets and even in the main window, but tooltips are still not working. I would appreciate any suggestions, as I have run out of ideas.



  • Show us the code (in a zip, compiling and all). It can also be an example reproducing the problem.



  • http://dl.dropbox.com/u/7027137/git_code.zip

    If you look at the gui/GameTab class, I'm trying to add a tooltip to the "new" button. No modifications I have tried have successfully generated a tooltip. If you can figure it out, I'll be grateful!



  • Change your event method in class GUI:

    @
    bool GUI::event(QEvent * event) {
    // ... do your work here
    return QApplication::event(event);
    // instead of return false
    }
    @

    If you reimplement virtual functions you should always call the base class' implementation if you do not want to handle the call yourself. Don't call the base class method if you are really sure what you do.



  • Again, thank you for your help Volker :)



  • Right on target again, Volker :) Issue solved, thanks.


Log in to reply