i have line edit want present float value. want flow value have digits precision used number function this:
float tax = value * 0.23; qstring strtax = qstring::number(tax, 'f', 2); qdebug() << strtax; ui->letax->settext(strtax);
the thing while in console value printed 2 digits precision, widget prints decimal digits might 3 or more (depends on value). there way fix it?i using qt 5.0
so accepted answer. solved problem. ontextupdate had update 2 more lineedits 1 containing tax , 1 containing total amount. 1 containing totalamount emitted ontextchanged update net value , tax lineedits, without rounding values(i careless!!). corrected totalamount's ontextchanged. updated check if has focus know if turn update other lineedits or not :). point edit netvalue line edit , update tax , total amount or enter totalamount , automatically update net amount , tax field. working now. thank answering!!
Comments
Post a Comment