Results 1 to 2 of 2

Thread: QLineEdit int type

  1. #1
    Join Date
    Jun 2007
    Posts
    28
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QLineEdit int type

    Hi,

    I want to take only a integer value from a QLineEdit (32 bit int).
    Can I use a QRegExp?

    Qt Code:
    1. QRegExp regExp(" ...???.... ");
    2. namedLineEdit[0]->setValidator(new QRegExpValidator(regExp, this));
    To copy to clipboard, switch view to plain text mode 

    Can someone help me?

    nowire
    Last edited by wysota; 25th October 2007 at 21:55. Reason: Changed [qtclass] to [code]

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QLineEdit int type

    You could use QIntValidator but I'd recommend using QSpinBox which is basically a specialized QLineEdit for numerical input and does it right(tm) in international applications.
    J-P Nurmi

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

    nowire75 (25th October 2007)

Similar Threads

  1. Installation on Fedora Core 4
    By jcr in forum Installation and Deployment
    Replies: 3
    Last Post: 29th January 2009, 01:34
  2. Replies: 6
    Last Post: 21st September 2007, 13:51
  3. QValidator, regular expressions and QLineEdit
    By hvengel in forum Qt Programming
    Replies: 1
    Last Post: 8th August 2007, 01:25
  4. dummy question(Error)
    By Masih in forum Qt Programming
    Replies: 12
    Last Post: 19th July 2007, 23:38
  5. How to dinamically change the type of a QCheckListItem
    By kalos80 in forum Qt Programming
    Replies: 4
    Last Post: 12th March 2007, 15:25

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.