fix(libsearch):解决加载svg(绝对路径的图片)图标失败的问题
This commit is contained in:
parent
c286bb0d81
commit
48c0c321aa
|
@ -22,12 +22,21 @@
|
|||
#include <QMutex>
|
||||
#include <QMutexLocker>
|
||||
#include <XdgIcon>
|
||||
#include <QFile>
|
||||
namespace UkuiSearch {
|
||||
static QMutex qtIconMutex;
|
||||
static QMutex xdgIconMutex;
|
||||
QIcon IconLoader::loadIconQt(const QString &name, const QIcon &fallback)
|
||||
{
|
||||
QMutexLocker locker(&qtIconMutex);
|
||||
if(QFile::exists(name)) {
|
||||
QIcon icon(name);
|
||||
if(!QIcon(name).isNull()) {
|
||||
return icon;
|
||||
} else {
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
return QIcon::fromTheme(name,fallback);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue