Fixed barcode scanner issue on Windows with czech keyboard.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
#include "helper.h"
|
||||
#include "define.h"
|
||||
|
||||
const QMap<QString, QString> Helper::m_numMap{
|
||||
{"+", "1"},
|
||||
{"ě", "2"},
|
||||
{"š", "3"},
|
||||
{"č", "4"},
|
||||
{"ř", "5"},
|
||||
{"ž", "6"},
|
||||
{"ý", "7"},
|
||||
{"á", "8"},
|
||||
{"í", "9"},
|
||||
{"é", "0"}
|
||||
};
|
||||
|
||||
Helper::Helper()
|
||||
{
|
||||
}
|
||||
|
||||
QString Helper::replaceByNumbers(const QString &str)
|
||||
{
|
||||
QString ret;
|
||||
|
||||
std::for_each(ALL(str), [&](QChar c){
|
||||
QString replaced = m_numMap[c];
|
||||
|
||||
if (replaced.isEmpty())
|
||||
{
|
||||
ret.append(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.append(replaced);
|
||||
}
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
Reference in New Issue
Block a user