bool ok; QString stempStr; QString valueStr=ui->lineEdit->text();//提取text中内容 int valueInt=valueStr.toInt(&ok);//将字符串转化为整形 double area=valueInt*valueInt*PI; ui->lineEdit_2->setText(stempStr.setNum(area));//将double转化为字符串