PDA

View Full Version : Verify fields in QTableWidget are complete?



alitoh
17th May 2011, 21:40
I'm trying to check, for every row in a QTableWidget that all its column fields are filled with data.

For each column I'm using delegates (different ones, for different data types), but I'd like to know if there's a certain "standard" or "elegant" way to resolve if all column fields are filled with data from QTableWidget?

I want to be able to control wheter the tablewidget is complete, so that when the user clicks Accept it checks if the user's input is valid.

ChrisW67
18th May 2011, 00:46
If you only want to check when they try to "accept" the whole table then the obvious approach of nested loops iterating over the rows and columns of the table checking that each cell is "complete" (by whatever definition) is as good as any. You could also determine the completion state once when the table is first loaded and maintain a current completion state by monitoring the cellChanged() signal: this would allow you to dynamically enable/disable an Accept button.

alitoh
18th May 2011, 14:49
If you only want to check when they try to "accept" the whole table then the obvious approach of nested loops iterating over the rows and columns of the table checking that each cell is "complete" (by whatever definition) is as good as any. You could also determine the completion state once when the table is first loaded and maintain a current completion state by monitoring the cellChanged() signal: this would allow you to dynamically enable/disable an Accept button.

Yes, I'm trying to avoid the first one... but I never thought about that second one, which seems kinda nice. I'll try to do something with that.

Thanks a lot.