解决多个文件同时拖拽到app,如果包含不支持打开的文件,不会提示错误的问题;

This commit is contained in:
yangjiaxuan 2024-01-05 15:35:58 +08:00
parent 90a691e424
commit 1d68833034
1 changed files with 8 additions and 2 deletions

View File

@ -1166,6 +1166,7 @@ HGResult HGImgThumb::insertItems(const QStringList &fileNames, int pos, bool app
bool findInThumb = false;
std::vector<QString> stdFileNames;
int count = 0;
for (int i = 0; i < (int)fileNames.size(); ++i)
{
QString stdFileName = getStdFileName(fileNames[i]);
@ -1205,16 +1206,21 @@ HGResult HGImgThumb::insertItems(const QStringList &fileNames, int pos, bool app
stdFileNames.push_back(stdFileName);
}
else
{
count++;
}
}
}
if (stdFileNames.empty())
if (count > 0)
{
if (!fileNames.empty())
{
QMessageBox::information(this, tr("tips"), tr("unsupported file format"));
}
if (stdFileNames.size() == 0)
return HGBASE_ERR_INVALIDARG;
}