how do i get/convert the text from a QLineEdit field. the code below is operated by a button / slot.
but when compiled and pressing the button, 0.00000000000 shows up. no calculation takes place, whatever numbers i type into fields.
float solution = 0.0;
QString value_A = ui->doubleSpinBox_1->text();
float floatvalue_A = value_A.toFloat();
QString value_B = ui->lineEdit_1->text();
float floatvalue_B = value_B .toFloat();
if(floatvalue_A == 0.0){
QMessageBox::information(this, "empty","",QMessageBox::Ok);
}
solution = (floatvalue_A * floatvalue_B);
ui->lineEdit_result_1->setText(QString::number(solution, 'f', 10));
the code editor indicates:
ui->lineEdit_result_1->setText(QString::number(solution, 'f', 10)); warning: implicit conversion increases floating-point precision: 'float' to 'double'
here also:
if(floatvalue_A == 0.0){ warning: implicit conversion increases floating-point precision: 'float' to 'double'
QMessageBox::information(this, "empty","",QMessageBox::Ok);
}
what am i doing wrong? i used the QMessageBox to find out where the code is going wrong, no values are retrieved from the form fields.