Comments (4)
thank you for your suggest.but in fact,we will call the function SoftKeyBoard::InitChinese() only one time,so maybe this is not a bug.
from qt4softkeyboard.
int the project you has commited, the function SoftKeyBoard::InitChinese() will be called every time when it was changed to chenese. If you want to call the function SoftKeyBoard::InitChinese() only one time,the member m_bIsChinese_ should be init as false,and bFirstInit should be change to false after initchinese succeed int function SoftKeyBoard::on_btn_language__clicked() .
after all,clean the map in function SoftKeyBoard::InitChinese() will not be wrong.
from qt4softkeyboard.
ouch,it's a bug,I'll fix it soon,thank you.
from qt4softkeyboard.
I have some idea to make this keybore become more smarter. Change function SoftKeyBoard::InitChinese() like that:
if(file.open(QIODevice::ReadOnly))
{
QString str;
QString key;
for(std::map<QString,std::vector >::iterator it = m_map_.begin();it != m_map_.end();++it)
{
it->second.clear();
}
// m_map_.clear();
QRegExp regExp(QString("([a-z]+)"));//正则表达式,获取拼音
while (!file.atEnd())
{
str = file.readLine();
// int pos = str.indexOf(regExp);
regExp.indexIn(str);
key = regExp.cap(0);
// key = str.mid(2,str.size() - 3);
int n = key.size();
//全拼匹配
if(n > 0){
// qDebug() << key << "---" << str.left(1);
m_map_[key].push_back(str.left(1));
++i;
}
//增加匹配规则
if(n == 2){
// qDebug() << key.left(1) << "---" << str.left(1);
m_map_[key.left(1)].push_back(str.left(1));
++i;
}
else if(n == 3){
// qDebug() << key.left(2) << "---" << str.left(1);
m_map_[key.left(2)].push_back(str.left(1));
++i;
}
else if(n > 3){
// qDebug() << key.left(3) << "---" << str.left(1);
m_map_[key.left(3)].push_back(str.left(1));
++i;
}
}
file.close();
}
have a try , goog luck!
from qt4softkeyboard.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qt4softkeyboard.