×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jan 2013
    Location
    Hyderabad,India
    Posts
    13

    [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
    Last edited by mahindar_275; 2013-01-23 at 07:11.

  2. #2
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,987

    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.

  3. #3
    Registered User
    Join Date
    Jan 2013
    Location
    Hyderabad,India
    Posts
    13

    Re: [URGENT] Need some help with QT creator

    Quote Originally Posted by vineet.jain View Post
    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.
    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

  4. #4
    Registered User
    Join Date
    Jan 2013
    Location
    Hyderabad,India
    Posts
    13

    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...

  5. #5
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,987

    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

  6. #6
    Registered User
    Join Date
    Jan 2013
    Location
    Hyderabad,India
    Posts
    13

    Re: [URGENT] Need some help with QT creator

    Quote Originally Posted by vineet.jain View Post
    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
    Thanks bro it is working

    If u don't mind can u help me up with this
    http://www.developer.nokia.com/Commu...es-in-sis-file

    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

Similar Threads

  1. Qt Creator update deletes QT Creator
    By arttu76 in forum [Archived] Qt SDKs and Tools
    Replies: 13
    Last Post: 2011-06-08, 10:45
  2. Replies: 7
    Last Post: 2010-07-14, 14:58
  3. 6630 and Http -- Nokia PLEASE HELP ME -- URGENT URGENT!!!!
    By earamsey in forum Mobile Java General
    Replies: 1
    Last Post: 2005-12-02, 17:06
  4. MORE URGENT THAN URGENT-need help with coding
    By jpcoffey in forum Browsing and Mark-ups
    Replies: 2
    Last Post: 2002-12-20, 15:13

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×