[SOLVED] Using standard icons of OS for Qt application



  • Hi,

    I would like to use some common icons for my app. like undo, redo, save and so on. In KDE all applications use same icons. I found that all icons, and generally all graphic resources are in in /usr/share (/usr/share/icons/oxygen/). I would like to use them in my app and when user changes theme of workspace or icons of workspace, my application theme changes too. Perhaps something cross-platform like QSettings that do job... does Qt provide something for this?





  • thnx :-)



  • You could also look at QStyle, which has a funciton called standardIcon which takes a enumerated type of the specific icon the current style uses.



  • You mentioned cross platform. fromTheme() apparently is not cross platform (not across Linux:OSX:Win, but maybe across KDE:Gnome.)

    bq. Note: By default, only X11 will support themed icons. In order to use themed icons on Mac and Windows, you will have to bundle a compliant theme in one of your themeSearchPaths() and set the appropriate themeName().

    I think 'bundle' means your distributed package would embed for example the Oxygen icon theme, since it would not be on the stock, non-Linux platforms.

    But QStyle.standardIcon() is cross platform in some sense: the icon would exist. Would the icon have platform look and feel? I think so. Would the icon follow the style of any theme chosen by a user? I'm not sure the platforms theme such icons, where 'standard' means ubiquitous across applications on a platform.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.