|
5Qter豆
void Widget::timefunction(){ int i=0,j=0; QChar c,h; QString s=ui->textEdit->toPlainText(); foreach(c,s) //寻找到末尾 { i++; if(c=='*') { j=0; foreach(h,s) //寻找到开头 { switch(h) { case 'a':ui->PaticleNum->setText(s.mid(j,i-1)); break; default:break; } j++; } } }}
为什么switch使用Qchar会报错?
switch quantity not an integer
|
最佳答案
查看完整内容
char QChar::toLatin1() const
Returns the Latin-1 character equivalent to the QChar, or 0. This is mainly useful for non-internationalized software.
Note: It is not possible to distinguish a non-Latin-1 character from a Latin-1 0 (NUL) character. Prefer to use unicode(), which does not have this ambiguity.
|