PDA

View Full Version : how to show a intger value in LineEdit



gauravg
27th February 2012, 03:11
hi all please tell me,how can i do:following
if i enter a int value in LineEdit1 and second int value in LineEdit2 add and perform addition operation on two int value and result should be show in LineEdit3;


thanks with regards:
gauravg

ChrisW67
27th February 2012, 04:25
How about you show us what you have tried and explain where your difficulty is.

Apart from sounding a lot like a basic assignment the requirement is a bit vague. When should the addition occur? What should happen if the user types a non-number into a edit box?

Spitfire
28th February 2012, 10:01
Vague question, vague answer:

LineEdit3->setText( QString::number( LineEdit1->text().toInt() + LineEdit2->text().toInt() ) );