Results 1 to 3 of 3

Thread: QTable - allowing it to only enter ints

  1. #1
    Join Date
    Feb 2006
    Posts
    87
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Question QTable - allowing it to only enter ints

    hey there i have created a table usng QTableWidget and i am wondering if there is a way to made the table so that the user can enter integers only and not strings aswell...? i want to do this because i want to do calculations on the user's input. is there a getData function which allows me to take the users input...?

    i used flags( ) to make the table so that certain parts cant have user input - is there a way to use flags to make it only integer inputs or does it use another function?? any help would be much apreciated thanks....Jag

  2. #2
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTable - allowing it to only enter ints

    Hi man,

    Check QValidator (and more specific, QIntValidator) to accept only integers !
    http://doc.trolltech.com/3.3/qvalidator.html

  3. #3
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QTable - allowing it to only enter ints

    In qt 3 you must subclasss QTableItem and reinplement createEditor().I think something like that must be in 4 version
    a life without programming is like an empty bottle

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.