[Qt-interest] QTableView doesn't use delegate

Arnold Krille arnold at arnoldarts.de
Sat Dec 12 12:35:11 CET 2009


Hi,

On Friday 11 December 2009 19:46:40 Timothy Reaves wrote:
> On Dec 11, 2009, at 1:35 PM, Timothy Reaves wrote:
> > 	Well, it looks like the main differences are I call setItemDelegate(),
> > not setItemDelegateForColumn().  I also don't implement
> > updateEditorGeometry().  I'll play around with your code as see what I
> > get.

setItemDelegate will use the delegate for all elements, 
setItemDelegateForColumn will only use it for specific columns. No other 
differences there...

> 	Well, I was mistaken; the methods are being called.  My error was in
>  thinking the delegate methods would be called for display; that's not the
>  case.  They are called for editing.  When called for editing, the widgets
>  are over-layed on the display widget.

Thats why the function you implemented have an "editor" in their name :-)

> 	Now, I need to figure out how to get the widgets to be used for display as
>  well.

paint() is the function you want to subclass. But that won't help you when you 
want to have real widgets to display that data.
But from my experience you should create widgets for display. Imagine a table 
with 10x10 elements, if each item is represented by a widget, that means 100 
widgets. That gets _slow_... Better to draw directly on the views canvas via 
paint().

Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091212/bb2792e9/attachment.bin 


More information about the Qt-interest-old mailing list