[Interest] Layouting children on Resize event vs LayoutRequest event

Christian Gagneraud chgans at gmail.com
Thu Sep 14 03:51:52 CEST 2017


Hi there,

I am observing a fundamental behaviour difference when moving/resizing
children widgets in resizeEvent vs doing the same on a LayoutRequest
event.

Basically, if i move the children on Resize event, Qt will triggers
events in 2 bunches (traced with QApplication ::notify() overload),
the first bunch contains move/resize events for the parent widget
(along with other widgets), the second bunch will contains the
recently moved/resized children events. I don't want this behaviour.

If i move/resize children on LayoutRequest event, all widgets will get
their resize/move events in a single bunch. I want this behaviour.

And my question is:
Is this behaviour guarenteed by Qt? Or could this behaviour change at
any moment?

The documentation [1] doesn't say anything about that. Could/should
the documentation be updated to reflect this difference?
I think that re-layouting children on LayoutRequest is actually more
efficient. as it gives Qt an opportunity to optimise out
move/resize/paint events.


Thanks,
Chris

[1] http://doc.qt.io/qt-5/layout.html#manual-layout



More information about the Interest mailing list