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