qt-interest@trolltech.com
[Top] [All Lists]

Re: [Qt-interest] QTableView and delegate

Subject: Re: [Qt-interest] QTableView and delegate
From: Andre Somers
Date: Mon, 09 Nov 2009 11:36:50 +0100
Wolfgang Pausch wrote:
> Hello,
>
>   
>> Delegates also work when just rendering the data. I am using that at
>> several places in my code. Just reimplement the
>> QAbstractItemDelegate::sizeHint() and QAbstractItemDelegate::paint()
>> methods. It is to be expected that the *editor* is not used for display
>> purposes... That would make for very heavy item views when you have a
>> lot of data in your view.
>>     
>
> Ok. Sounds good.  However, I just want to exchange the data the table should
> display, not the way how some string (5, "foo", etc.) is rendered.  So, when
> reimplementing the paint method, conceptionally I would just need to call the
> usual paint method of the table, with exchanged data.  But how?
>
> Can you point me to some sample code regarding this?
>   
I agree with other authors that a custom (proxy) model would probably be 
the best solution for you. However, overriding the paint is not that 
hard either. One way is to subclass QStyledItemDelegate and reimplement 
it's displayText method. That should already do it.

André

_______________________________________________
Qt-interest mailing list
Qt-interest@xxxxxxxxxxxxx
http://lists.trolltech.com/mailman/listinfo/qt-interest

<Prev in Thread] Current Thread [Next in Thread>