Open mherrmann opened 5 years ago
I don't know if you already found the bug, but I think I know what is going on. (Thanks procrastination!)
So what I wanted to do in the first place is to write a plugin that is using the QIcon
interface to dynamically choose the set of icons I want in fman. That didn't work out.
After some testing with an example C++ Qt5 application I thought hm maybe QtStyle
is the problem here. Ok let's print out the known style keys...
That already gave me a pretty good idea what is going on. It should detect qt5ct
or kvantum
in order to use my system settings. And it doesn't look like fman is using the Windows QtStyle
...
What I did after that is modify one of the Qt5 Examples that deals with QtStyle
and added some icons there. After I disabling the irrelevant part my system style loaded and everything was looking fine
To confirm my theory I tried to Fusion
on startup to see if the icons would stay the same and they did not. They even report the wrong icon theme for some reason...
I attached both my plugin and the modified example. To see the difference in the Qt 5 Widget example remove the comment on line 122. I attached both my simple fman plugin and the modified Qt example.
fman-Iconbuster.zip styles-iconmod.zip
I think the solution is basically since you ship your own version of Qt to either
QStyle* style = QStyleFactory::create("What ever QT_QPA_PLATFORMTHEME is set to?");
QApplication::setStyle(style);
But I think this has to happen early on in the application so at this point I think I can't do more. It might be also not easy to get your Qt to detect the system Qt themes but I never had to deal with this before so I might be wrong on that.
Thank you very much for the research. fman quite literally does have the following in its code:
style = QStyleFactory.create('Fusion')
app.setStyle(style)
Do you think it will work if I change it to:
style = QStyleFactory.create(os.environ.get('QT_QPA_PLATFORMTHEME', 'Fusion'))
app.setStyle(style)
This uses QT_QPA_PLATFORMTHEME
if it is set, otherwise 'Fusion'
.
That should work for X11 users. On Wayland I'm not sure 100% sure since QT_QPA_PLATFORMTHEME can be (or always is?) set "wayland". What that means for fman? I don't know yet because here I'm "cursed" with Nvidia. But at the office i'm running Wayland and could check if this creates any problems.
That is if Wayland is a concern for you at the moment.
I released fman 1.6.0 now with a more careful version of my fix above. Can you let me know whether it works for you?
Unfortunately still no icons.
Mh I think it's just one part of the puzzle. I suspect that the Qt library that you ship with fman just doesn't pickup qt5ct. Maybe I can it "install" by sym-linking the right files but I'm afraid that will be as successful as me trying to get fman use the system Qt5 libraries. The difference on my already starts at Python (you seem to use 3.6 but Arch is shipping 3.7).
I wonder if it would be easier to recreate your shipping scenario and experiment there so I can rule out binary incompatibility...
I'm now on i3 myself and thus have renewed interest in this problem. Have you found a way to fix it by any chance?
Without your source code I think this will be not easy... If you are still bundling your own Qt with fman on Linux I would start searching around there. For example making sure that fman is using the system Qt installation. I never had the chance to try this back then.
I see, okay, thanks!
See https://github.com/fman-users/fman/issues/293#issuecomment-490375209.
https://user-images.githubusercontent.com/114687/57356577-0d4e7700-7171-11e9-814f-4814550db07d.png![image](https://user-images.githubusercontent.com/1076393/57377153-0724be80-71a2-11e9-9549-4845053cee22.png)