Results 1 to 4 of 4

Thread: conversion of lineedit text to numeric form

  1. #1
    Join Date
    Mar 2011
    Posts
    21
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default conversion of lineedit text to numeric form

    i want to build simple calculator that add two numbers
    i am using lineedit for taking input how can i use that value and convert it to some numeric form
    for calculation
    plz help

  2. #2
    Join Date
    Mar 2011
    Posts
    8
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Symbian S60

    Default Re: conversion of lineedit text to numeric form

    ui->lineEdit->text().toInt()

    additional you can define an input mask for the lineedit.
    Last edited by ghal maraz; 9th March 2011 at 16:43. Reason: updated contents
    develboard.blogspot.com - Private German Blog and Wiki about Qt and Linux related Stuff

  3. The following user says thank you to ghal maraz for this useful post:

    sachinmcajnu (9th March 2011)

  4. #3
    Join Date
    Mar 2011
    Posts
    21
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: conversion of lineedit text to numeric form

    Quote Originally Posted by ghal maraz View Post
    ui->lineEdit->text().toInt()

    additional you can define an input mask for the lineedit.
    also plz tell me if have add two nos ........how can i set the label to that no

  5. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: conversion of lineedit text to numeric form

    The QString documentation tells you everything you need. How to convert from text to number and how to convert from number to text.

Similar Threads

  1. lineEdit's setSelection - How to show more text?
    By squidge in forum Qt Programming
    Replies: 3
    Last Post: 30th January 2010, 17:22
  2. Get text from dynamic lineedit
    By wirasto in forum Qt Programming
    Replies: 1
    Last Post: 13th January 2010, 18:56
  3. Enabling buttons when lineEdit has text
    By k12yp70n in forum Newbie
    Replies: 4
    Last Post: 29th May 2009, 07:18
  4. Lineedit text change signal
    By zgulser in forum Qt Tools
    Replies: 2
    Last Post: 19th January 2009, 13:38
  5. read and write content of lineedit widget in Other Form
    By validator in forum Qt Programming
    Replies: 1
    Last Post: 25th April 2008, 15:07

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.