Important: Please read the Qt Code of Conduct -

Get tooltip text from QStyleSheet

  • Hi Folks,

    as the title points to you, I would like to manage all of the tooltip texts from a centralised place.
    A bit detailed description: I have a quite complex UI with lots of control. I would like to set tooltips for each of that. I know the following two ways:

    • Set the text of ToolTip via Qt Designer (very decentralised, but I have lots of same resource text)
    • Call the setToolTip() method in (for example) the constructor (too much function call)

    Maybe, is it possible to set the text from the QStyleSheet, or some other centralised resource?


  • What about writing a script to do the job for you ? With style sheet you can change the look and feel only.

  • Lifetime Qt Champion


    You can take a look at the "Tool Tip Example", it might give you some ideas

    Hope it helps

Log in to reply