PDA

View Full Version : Cannot connect a Table + customTablemodel with an itemdelegate.



tonnot
3rd May 2011, 08:52
I'm trying to use a Itemdelegate with custom models. I cant.
Please, What have I to say to custommodel ?
I have tried to mix the examples addresbook with the spinboxdelegate without success.

Apparently, all the examples seems to work only with standarmodels .
I am completely stopped, so any help will be appreciated

Thanks

tonnot
3rd May 2011, 15:16
Nobody can answer me ?
A link to an example ?
Thanks

Lykurg
3rd May 2011, 16:58
Sorry that we haven't respond after 6 hours and 24 minutes. This won't happen again. To your problem: it is perfectly possible to use custom item delegates with custom models. So what do you expect that I say? Once more: a little piece of code would be nice to see what you have done. And instead of copy things together start small, and set up a minimal custom model with a minimalistic item delegate and develop from there.

tonnot
3rd May 2011, 18:14
This is the addressbook example modified.
At mainwindow I have 5 'addentry' commands.
Later, I have modified tablemodel::data to retuns always a int(1) value (in order to let spinbox 'delegate' works)
I have also a 1ABC, 2DEF ... filters (to let the 1 values to be showed)

This is How I conect the delegates to the tableview.


my_delegate = new A_delegates();
tableView->setItemDelegate(my_delegate);
I only see '1' value when edit the cell nothing during display.
I have test the a_delegates agains other examples that are using standar models and it works (I see the values and if I edit them the spinbox are showed). But in the case of custom models I have problems.

I hope you can to try the example without problems.
Thank you very much for your patience.