PDA

View Full Version : View delegate - how to make it always visible?



TorAn
2nd April 2010, 13:16
I am using model-view with QTreeView as a view and a model derived from QAbstractTableModel. One of the columns has custom delegate (spinbox) for editing values.

Question: I can't find a way to make a delegate view constantly visible. I want spinbox to be always visible in a treeview, not only when treeview cell of the "spinbox" column is in edit mode.

Any advise or link to the documentation is appreciated. Thanks

wysota
2nd April 2010, 13:43
The delegate is never visible. It's just a C++ object. What can be visible is the item editor provided by the delegate. And now that you know how it is called, it should be easier for you to find the proper call in the view's API.

Nickolay
24th June 2010, 22:28
Can you describe more detailed how implement this possibility? ))
A lot people will be thanks to you!

Talei
25th June 2010, 03:15
AFAIK You can't do that, because SpinBox is QWidget and Views can't display normally QWidget.
Said that You can achieve that overriding paint event on the Delegate and implement painting Yourself. Of course this will only "imitate" actual widget for the view purpose, and You of course need delegate to edit. So basically You use delegate to get access to the data, and override paint to simply display / paint desired QWidget on the view (View is untouched that way).

Ginsengelf
25th June 2010, 07:28
Hi, a "persistent" editor is what you're looking for.

Ginsengelf