Solved using qtstyle standard icons in qt designer
-
I have searched everywhere for this, all the answers that say it can't be done are 5 years old. I saw a mailing list for qt say that this functionality was added in qt 4.8. I can not find out how to do it.
So... how do i use standard pixmaps from qstyle for my qaction icons in qt designer?
-
There are two fields for choosing an icon in action editor. One is for resource file and directly above it is a text field for a standard icon from theme.
The generated code for this uses QIcon::fromTheme() and thus falls under some restrictions: the available names list is listed here.
Mind the note in thefromTheme()
docs - by default it works only on X11. For other platforms you would need a custom theme. -
I know about themes, I was speaking specifically of QStyle::StandardPixmap icons. I would like to use them so it would be consistent across platforms, without having to use someones icon set and have to have an extra file with the license giving credit for the icon set. Is there any way to use QStyle::StandardPixmap in qt designer?
-
I never said anything about providing your own icon files.
Also, using QStyle::StandardPixmap is not consistent at all. As a matter of fact it's completely the opposite - it provides system specific pixmaps that will vary wildly.What I said is you can use theme icons feature. The theme can give you an icon from anywhere. On X11 it will be the system icon. On Windows and Mac you need a custom style that will provide the right icons for QIcon::fromTheme() (implemented using standardIcons() with QStyle::StandardPixmap enum if you want).
-
ok, can you give me a link that describes using styles?
-
I am reading about stylesheets, but I can't seem to get the search terms right to see the syntax for setting a theme fallback for a specific icon name. Can anyone point me in the right direction?
-
Stylesheets are another separate thing. They can't do anything in this particular case.
I don't know any example I could point you to. I think the easiest would be to take the source of the X11 platform plugin and look there how to implement support for theme icons. It might turn out to be as easy as implementing a method or two in the QProxyStyle subclass, but I've never done it so can't tell you the specifics. -
I found out that the standard icons are not enough to fill a toolbar. I will just be creating my own icons in inkscape for my apps. Thanks chris for all your help