Qt光标问题?
QTextCursor prev_Curosr=ui->Input->textCursor();
qDebug()<<prev_Curosr.position();
QTextCursor currentCurosr=prev_Curosr;
int num1=string_to_int(expr1);
int num2=string_to_int(expr2); /*计算结果*/
/* Display the result */
ui->Input->appendPlainText(QString::number(num1+num2));
qDebug()<<"Hello"<<currentCurosr.position()<<endl;
qDebug()<<prev_Curosr.position();
if(prev_Curosr.position()==prev_Curosr.position())
ui->Input->insertPlainText(QString("Hello world"));
return 0;
}
3
Hello 5
5
求问:为什么prev_Cursor currentCursor会在appendPlainText执行之后变成5,没道理呀
魔性D小小蝉
9 years, 6 months ago