[SOLVED] Need some help with QT creator
Hi friends,
I was trying to make a simple program. I haven't wrote any code
I just added three text fields and a button... When i press the button the numbers in textfield1 and textfield2 should get added a displayed in textfield3.
I tried this
onClicked: textfield3 = textfield1+textfield2
but it didn't work
I think they should be converted into integer and then should be added
Any one suggest me how to do that..
Sorry for my bad English:)
Re: [URGENT] Need some help with QT creator
That will treat the numeric value entered in the text field as string only. So if you entered '2' in text field 1 & '3' in text field 2 then textfield1+textfield2 would result in '23'.
To make this work you can utilize ParseInt method as below:
onClicked: textfield3.text = parseInt(textfield1.text) + parseInt(textfield2.text)
See if this works.
Re: [URGENT] Need some help with QT creator
[QUOTE=vineet.jain;909754]That will treat the numeric value entered in the text field as string only. So if you entered '2' in text field 1 & '3' in text field 2 then textfield1+textfield2 would result in '23'.
To make this work you can utilize ParseInt method as below:
onClicked: textfield3.text = parseInt(textfield1.text) + parseInt(textfield2.text)
See if this works.[/QUOTE]
No bro it ain't working
Should i import any libraries for it... because when i type par the parseInt is not available in the drop down menu
Re: [URGENT] Need some help with QT creator
sorry bro It is working thank you very much :)
I forgot to paste the .text
Can u tell me how to keep the focus on any text field.. I mean it should open with cursor in any text field
This is my first app and struggling from a week to make it
Really thank you very much bro...
Re: [URGENT] Need some help with QT creator
Do you mean that you always want to keep the focus on the text field, if yes then you can keep the focus as always true for TextField:
focus: true
Re: [URGENT] Need some help with QT creator
[QUOTE=vineet.jain;909791]Do you mean that you always want to keep the focus on the text field, if yes then you can keep the focus as always true for TextField:
focus: true[/QUOTE]
Thanks bro it is working
If u don't mind can u help me up with this
[url]http://www.developer.nokia.com/Community/Discussion/showthread.php?238970-HELP-How-to-hide-qml-files-in-sis-file[/url]
and
I want to check whether the entered character is Numeric or not.. If numeric add them else display error in textfield
I tried this.. As the fields are empty
if(textfield1.text=="" || textfield2.text=="")
{
textfield3.text="Fields are Empty"
}
and i don't know how to check the condition if i enter a string
Sorry Iam newbie Thanks bro