编译的时候会出错,错误指向了EditWidget.cpp line 266。
bool EditWidget::IsPartOfWord(SexyChar theChar)
{
return (((theChar >= _S('A')) && (theChar <= _S('Z'))) ||
((theChar >= _S('a')) && (theChar <= _S('z'))) ||
((theChar >= _S('0')) && (theChar <= _S('9'))) ||
(((unsigned int)theChar >= (unsigned int)(L'?)) && ((unsigned int)theChar <= (unsigned int)(L''))) ||
就是以上代码的最后一行导致的错误,第一个unicode的字符似乎乱码了。
{
return (((theChar >= _S('A')) && (theChar <= _S('Z'))) ||
((theChar >= _S('a')) && (theChar <= _S('z'))) ||
((theChar >= _S('0')) && (theChar <= _S('9'))) ||
(((unsigned int)theChar >= (unsigned int)(L'?)) && ((unsigned int)theChar <= (unsigned int)(L''))) ||
这种取码的方式似乎有点不太妥当,还不如直接写入其编码值,
因为很多编辑器可能是不支持unicode的,总会有办法让它乱码的=。=
修改了一下,如下:
bool EditWidget::IsPartOfWord(SexyChar theChar)
{
return (
( (theChar>=_S('A') ) && (theChar <= _S('Z')))
|| ( (theChar >= _S('a') ) && (theChar <= _S('z')))
|| ( (theChar >= _S('0') ) && (theChar <= _S('9')))
|| ( ((unsigned int)theChar>=129) && ((unsigned int)theChar<=255) )
|| ( theChar == _S('_'))
);
}
这样子就好了。 {
return (
( (theChar>=_S('A') ) && (theChar <= _S('Z')))
|| ( (theChar >= _S('a') ) && (theChar <= _S('z')))
|| ( (theChar >= _S('0') ) && (theChar <= _S('9')))
|| ( ((unsigned int)theChar>=129) && ((unsigned int)theChar<=255) )
|| ( theChar == _S('_'))
);
}