Skip to content

Commit

Permalink
Res::get file errors #641
Browse files Browse the repository at this point in the history
  • Loading branch information
timi-liuliang committed Apr 21, 2020
1 parent e88cbcb commit 9dcb087
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
15 changes: 9 additions & 6 deletions editor/QLibrary/Resources/QLibrary/propertyeditor/QResSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,18 @@ namespace QT_UI
Echo::String path = val;
if (!path.empty())
{
Echo::String fullPath = Echo::IO::instance()->convertResPathToFullPath(path);
Echo::String ext = Echo::PathUtil::GetFileExt(path, true);
if (Echo::StringUtil::Equal(ext, ".png", false))
if (!ext.empty())
{
QPixmap pixmap(fullPath.c_str());
QRect tRect = QRect(rect.left() + 3, rect.top() + 2, rect.height() - 4, rect.height() - 4);
painter->drawPixmap(tRect, pixmap);
Echo::String fullPath = Echo::IO::instance()->convertResPathToFullPath(path);
if (Echo::StringUtil::Equal(ext, ".png", false))
{
QPixmap pixmap(fullPath.c_str());
QRect tRect = QRect(rect.left() + 3, rect.top() + 2, rect.height() - 4, rect.height() - 4);
painter->drawPixmap(tRect, pixmap);

return true;
return true;
}
}
}

Expand Down
16 changes: 10 additions & 6 deletions editor/echo/Editor/UI/ResPanel/QPreviewHelper/QPreviewHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,17 @@ namespace QT_UI
Echo::String resPath;
if (Echo::IO::instance()->convertFullPathToResPath(fullPath, resPath))
{
Echo::ResPtr res = Echo::Res::get(resPath);
if (res && res->getEditor())
Echo::String extWithDot = Echo::PathUtil::GetFileExt(resPath, true);
if (Echo::Res::getResFunByExtension(extWithDot))
{
icon = res->getEditor()->getThumbnail();

if(res->getEditor()->isThumbnailStatic())
resIconMap[fileExt] = icon;
Echo::ResPtr res = Echo::Res::get(resPath);
if (res && res->getEditor())
{
icon = res->getEditor()->getThumbnail();

if (res->getEditor()->isThumbnailStatic())
resIconMap[fileExt] = icon;
}
}
}

Expand Down

0 comments on commit 9dcb087

Please # to comment.