[Qt] Problems with OwnerDraw ListWidget and friends

Paul Ishenin ip at kmiac.ru
Fri Jul 27 10:37:45 CEST 2007


Den Jean wrote:
> On Friday 20 July 2007 05:54:09 Paul Ishenin wrote:
>> In LCL we have many item containers that can have custom draw item events.
> 
> I see the binding for LCL needs, not for pascal Qt programming. For this 
> indeed method overriding is lacking. For LCL it is normally not needed, 
> almost everything can be overriden via the eventfilter (proof is CLX).

Ok, I looked at CLX. Please tell me what is:
QClxListItem_measure_Event, QClxListBoxHooks_hook_measure,
QClxListItem_paint_Event, QClxListBoxHooks_hook_paint

> So everything needed is present. 

No. As I understand borland used same approach. They subclassed 
QAbstractItemDelegate or QItemDelegate and overrided sizeHint and paint. 
They also provided that two methods: QClxListBoxHooks_hook_measure and 
QClxListBoxHooks_hook_paint.

We need something about the same. We need to subclass QItemDelegate and 
provide 2 our own event. Measure event will be passed on 
QItemDelegate.sizeHint call and paint event on paint.

If that events are not processed then default behaviour should be used.

> Anyhow creating a framework for method overriding is a 
> lot of work, weeks, so perhaps it is better spent on something else.

No we doesnot need such framework. We need only one special class in 
bindings (written on c++) and need 2 special hook install methods. No 
more no less.

> I would prefer that the simple things work first, before we 
> work on custom drawn combo box items. But we can also come
> back on this later.
> 
> Radio buttons do not work yet, even with the QT_HIDDEN_BUTTON_WORKAROUND.
> The horizontal positions are not correct, nor the tab order (key up/down). 
> Could we work on such things first. I tried to read the code, but do not even 
> find were the positions are set.  

hope it is fixed now :)

Best regards,
Paul Ishenin.




More information about the Qt mailing list