PDA

View Full Version : QTable - allowing it to only enter ints



therealjag
14th February 2006, 17:50
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

guilugi
14th February 2006, 18:31
Hi man,

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

zlatko
14th February 2006, 18:33
In qt 3 you must subclasss QTableItem and reinplement createEditor().I think something like that must be in 4 version:confused: