View Single Post
Old 12-15-2011, 09:18 AM   #9
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,463
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
IIRC, you don't set the widgets. Instead you provide an "item" for each cell. I think that the "setItem" call is speaking to the internal model & view. The view creates the widgets using default delegates.

The default view (built in to QTableWidget) will use the default delegate for a type. SetItemDelegateForColumn replaces that delegate with yours. The view will invoke the delegate passing the internal model. When it is time to dosplay something, something in the view will call the delegate's setEditorData(), which in turn will ask the supplied model for the data using model.data(). Alternatively, and if the delgate has the QTableWidget instance (and it can if passed to the constructor), it can get the data using tablewidget_instance.itemAt().

Have fun experimenting.
chaley is offline   Reply With Quote