[Development] Wrong resize event for QAbstractScrollArea derives

Olivier Goffart olivier at woboq.com
Wed Oct 16 15:42:33 CEST 2013


On Friday 11 October 2013 13:31:31 raven-worx Software wrote:
> Hi,
> 
> a question out of curiosity:
> In QAbstractScrollArea::viewportEvent() a resize event is passed to
> the base class implementation of the event handler. Whats the reason
> for doing this for a non input event?
> 
> I'm asking because, this actually causes that you receive a wrong
> resize event for your scroll area widget, which actually didn't resize
> at all.
> 
> I hope i haven't overseen something?
> 
> You can find this code in Qt4 and still in Qt5.

Because QAbstractScrollArea::resizeEvent, as documented, is supposed to be 
called when the viewport is called.
This is the behaviour of QAbstractScrollArea with most event.  you can 
intercept viewport event form the widget itself. 
One can argue if it is a good idea, but it has been like that since Qt 4.0 and 
is not going to change now.

-- 
Olivier

Woboq - Qt services and support - http://woboq.com - http://code.woboq.org



More information about the Development mailing list