[Interest] paintEvent
Igor Mironchik
igor.mironchik at gmail.com
Wed Jan 29 13:07:46 CET 2014
>
> 29.01.2014, 14:43, "Igor Mironchik" <igor.mironchik at gmail.com>:
>> Hi.
>>
>> I'm implementing AbstractScrollArea and ScrollArea for QtMWidgets library.
>>
>> Almost all have been done except painting scroll indicators.
>>
>> The problem is that that I can't draw on child widget. I installed event
>> filter for the child widget, and in the filter I invoke paint method for
>> scroll indicators. All is ok, but child's paint event become after event
>> filter's paint event. And child's paint event paints on my scroll
>> indicators.
>>
>> Is there any way to invoke child's pain event in filter method? I can't
>> simple invoke child's paint event because this method is protected...
>>
>> Any adeas?!
>>
> You cannot neither paint on child widget, nor manipulate paintEvents' order.
>
> There are 2 possibile ways:
>
> 1. Implement these widgets as one custom widget (best performance, more code).
> For example, your scroll area can take rendering delegate with paint() method,
> called in proper moment from your paintEvent() to draw contents.
It's possible. But I will impose a restriction for users of ScrollArea.
They will be required to subclass from specific widget to put something
for scrolling. Where I want to do API of ScrollArea as QScrollArea. I.e.
to do possible to put any widget to the ScrollArea without thinking of
painting scroll indicators and so on.
> 2. Add 3rd widget on top of scroll area (worse performance, but simpler)
The first approach is simpler to implement for me than second. But I
don't know what will be better for the end-user.
In the second approach the user will not have any pain with subclassing.
He will simple put widget to the ScrollArea and that's all...
What better to implement?
--
Best Regards,
Igor Mironchik.
More information about the Interest
mailing list