一、绝对路径
setStyleSheet("background:url(c:/xxx/theme/img.jpg)");
二、相对路径
setStyleSheet("background:url(/theme/img.jpg)");或setStyleSheet("background:url(./theme/img.jpg)");
三、从QRC中加载
setStyleSheet("background:url(:/theme/img.jpg)");
可手动编辑xx.qrc文件或通过vs操作。
原文:https://www.cnblogs.com/xiaochuizi/p/10449053.html