fix: 修复编译警告

Description:   修复ocr接口的编译警告

Log: no
Change-Id: I842b2382e314b949438bf40889c68ad87309b951
This commit is contained in:
wangcong 2021-07-05 11:52:20 +08:00
parent 095772230c
commit f6e4bbbdf0
2 changed files with 20 additions and 11 deletions

View File

@ -210,6 +210,7 @@ QString TessOcrUtils::getLanguages()
//当前系统语言 //当前系统语言
Languages t_systemLang = getSystemLang(); Languages t_systemLang = getSystemLang();
//当前系统语言如果不为中文,而是任何国家的语言则只返回英文
if(t_systemLang == Languages::ENG) if(t_systemLang == Languages::ENG)
{ {
t_langs=getLangStr(t_systemLang); t_langs=getLangStr(t_systemLang);
@ -279,6 +280,9 @@ RecognitionResult TessOcrUtils::getRecognizeResult(Pix * image,ResultType result
case ResultType::RESULT_STRING: case ResultType::RESULT_STRING:
result = QString(t_Tesseract->GetUTF8Text()); result = QString(t_Tesseract->GetUTF8Text());
break; break;
default:
result = QString(t_Tesseract->GetUTF8Text());
break;
} }
} catch (const std::logic_error &e) { } catch (const std::logic_error &e) {
//errorMesage = "识别图片失败!" + QString(qExc.what()); //errorMesage = "识别图片失败!" + QString(qExc.what());
@ -349,6 +353,9 @@ QString TessOcrUtils::getLangStr(Languages lang)
case Languages::ENG: case Languages::ENG:
langStr = "eng"; langStr = "eng";
break; break;
default:
langStr = "eng";
break;
} }
return langStr; return langStr;
} }
@ -365,18 +372,20 @@ bool TessOcrUtils::isExistsResultType(ResultType resultType)
case ResultType::RESULT_HTML: case ResultType::RESULT_HTML:
flag = true; flag = true;
break; break;
default:
flag = false;
} }
return flag; return flag;
} }
//判断指定的语言包类型是否存在 //判断指定的语言包类型是否存在 (尚未使用,后面需支持多种语言时可以考虑是否启用)
bool TessOcrUtils::isExistsLanguage(Languages lang) //bool TessOcrUtils::isExistsLanguage(Languages lang)
{ //{
bool flag = false; // bool flag = false;
QString str = getLangStr(lang); // QString str = getLangStr(lang);
if(!str.isNull() && !str.isEmpty()){ // if(!str.isNull() && !str.isEmpty()){
flag = true; // flag = true;
} // }
return flag; // return flag;
} //}

View File

@ -200,7 +200,7 @@ private :
* @param * @param
* @return true * @return true
*/ */
bool isExistsLanguage(Languages lang); //bool isExistsLanguage(Languages lang);
/** /**
* @brief * @brief