我发现的唯一解决方案是让环境为您完成工作,如此处所述:https ://forum.kde.org/viewtopic.php?f=17&t=90720
来自帖子的片段:
因此,您希望使用与 KDE 的其余部分不同的配色方案来启动 Amarok?您可以通过为其设置一组不同的设置来做到这一点。
打开 Konsole,输入“export KDEHOME=$HOME/.kde4-amarok/”然后运行“systemsettings”并配置您希望 Amarok 出现的方式(配色方案等)最后,运行“amarok”启动 Amarok 本身。
This will work for QT applications as well, but you can't set the style from within the application like you're trying (app.setStyle(QStyleFactory::create("oxygen");
) You'll have to use a slightly messier method:
sys.argv.append("--style=Oxygen")
This will read the argument from the environment, and won't make a whole new Oxygen theme instance, (assuming you've set the KDEHOME
environment to somewhere in your project, and you've already customized that) and will then use that KDEHOME
to read the colors from and use the Oxygen
theme.
Maybe they'll change this for QT5... (The ability to set a style programmatically)