PDA

View Full Version : Question about custom view (or custom delegate)



skuda
20th September 2009, 11:05
Hello,
I need to create an editor table and i would like to hear your suggestions because i am not sure what could be the best method to get it done.

I have an sql model with a QTableView that i have to maintain like an alternate method to input data to the database so i will make the model for the new view a QAbstractProxyModel subclass so the two views get updated with the model, i have done this before without problem but never i needed a view like that.

Original SQL Model has this columns.
barcode | supplier code | description | size | units | price | total | date

And i need to get an editor like this:

barcode | supplier code | description | price | total price
15831500 090123-543 blue t-shirt 25$ 275$
| Date | XXL | XL | L | M | S | TOTAL
2009-11-15 1 1 2 2 1 7
| Date | XXL | XL | L | M | S | TOTAL
2009-12-01 0 2 1 1 0 4

It seems like a QTreeView but the columns of parent and children are not in sync, and the children of other root items will not have the same number of size columns, i have thought make it a big column and add the headers in the cell with delegate paint method but then to me it does not seems like a treeview no more. I am sure will be much better ways to do that, any ideas please?

Regards,
Miguel Angel.

skuda
21st September 2009, 20:06
please nobody has a better suggestion or a confirmation of what i am thinking it is a correct way?