View Full Version : Table and validating cells

9th February 2007, 22:41
Please, has anybody a simple sample that explain how to validate cells (double or int) or a good, but simple, post that explain howto (if you have the sourcecode, better). :crying: :crying:
I'm trying to programm a table where i can resize columns (or not), fixed columns width, resize rows height, resize table height and validate cells.
I've read a lot of post and qt help about deltegate, qtableWidget, qtableWidgetitem..... but i dont understand how to do this. :confused: :confused:

Thanks a lot for your information.

10th February 2007, 00:22
Take a look at the spinbox delegate example bundled with Qt, you can make use of it. The only thing you need to do is to install a QValidator subclass on the editor.

There is an alternative solution, which should be much simpler. Reimplement setData() for your model or item and either allow a particular change to the data or not. With the model approach you can additionally return false from setData() to indicate that the change was rejected.