void Dialog::on_radiusLabel_clicked()
{
bool ok;
QString tempStr;
QString valueStr = ui->radiusLineEdit->text();
int valuelnt = valueStr.toInt(&ok);
double area = valuelnt*valuelnt*PI;
ui->label_2->setText(tempStr.setNum((area)));
}
這兒每句要怎麼理解啊
void Dialog::on_radiusLabel_clicked() //當半徑標簽點擊時觸發
{
bool ok; //定義一個標志,表示ok
QString tempStr;
QString valueStr = ui->radiusLineEdit->text(); //從半徑文本框獲取值
int valuelnt = valueStr.toInt(&ok); //將值轉換為整數,是否轉換成功放入ok標志
double area = valuelnt*valuelnt*PI; //面積等於半徑平方*pi
ui->label_2->setText(tempStr.setNum((area)));將面積輸出到label2
}