I am developing an app using Qt designer and struggling with mechanizing the icon resource themes. Essentially, I'd like to access all of the standard icons when I click choose resource. Where on earth is the standard icon resource.
thanks
I am developing an app using Qt designer and struggling with mechanizing the icon resource themes. Essentially, I'd like to access all of the standard icons when I click choose resource. Where on earth is the standard icon resource.
thanks
Qt's resource system is for icons you bundle with your program. It's not the same thing as the system icon theme. To use a system icon, here's what you do:
Click the triangle next to icon
in Qt Designer's property editor. You'll see a Theme
row in the expanded view which accepts arbitrary text.
Find your icon theme in /usr/share/icons
, check what the icon's filename is, and then check the XDG Icon Naming Specification to make sure you're using the official name and not some compatibility alias for an older desktop that not all themes will provide.
Fill in the icon's filename, without the extension, in the Theme
row. Qt will use this to request the icon from the system theme at runtime. If you got the name right, you should see the icon appear in the Qt Designer preview immediately after pasting or typing the last letter of the name.
As a fallback, you need to also build a resource from the icons. According to the Qt docs, you can use rcc -project
to generate a resource file from the icon theme but I've yet to do that, so you'll have to figure out the minutae of that yourself.
I'd probably just add the icons to a resource bundle manually using the Resource Browser and then set the Normal Off
row below Theme
since Qt Designer's behaviour seems to indicate that it'll be treated as a fallback for the system icon theme.