Important: Please read the Qt Code of Conduct -

Set as icons the theme's defaults?

  • Hello, I am using ubuntu linux and I am developing an application and I want to free some space from it, so I chose to replace some icons (the play/start/pause ones) with the system's default. The icons are located in /usr/share/icons but their location changes every time the user changes its theme. That means that i cannot have a path and be sure that the system's icon will be there.
    For example, if a user has the 'default' theme, then the 'play' icon will have as path:
    But if the user change theme, for example switch to 'oxygen' theme, the 'play' icon will be located at

    Is there any function from Qt that calls the default icons?
    For example
    QIcon::Play or QIcon::Pause ?

    Applications like Clementine (Qt based) and totem that have their icons depending on the system's theme, so such a function should exist

    Thanks for any reply...

  • Yes you can use QIcon::fromTheme() for this.


  • Note that if you deploy your application on windows or mac fromTheme will return an empty icon by default so might have to provide fallbacks on those platforms. (though usually windows and mac users don't use icons for menu entries or buttons anyways)

  • thanks.
    Is there any list in which I can use so as to see which are my options?
    For example I want the play button ( > ) the pause ( || ) etc, but they don't seem to exist....

    How do I know which are my options?
    Thanks again

  • Thanks for that! I need it also for my app ;)

Log in to reply