Fix Brush HUD width adjustment
This time hopefully for real.
There are two issues to bypass:
- Layouts don't just instantly calculate new dimension as you modify them, it would be way too expensive, so Qt has a delayed pass for that in the event loop. So we need to wait until this has happened for the properties layout before resizing.
- QScrollArea has a pretty broken sizeHint() implementation. It will just not give us a useful size that we could use. See also QTBUG-76256 and QTBUG-58447
The most sane solution I could come up with is to install the
HUD widget as event filter for the content widget of the scroll
area, and catch the LayoutRequest event. This event gets sent
by the layout to the parent widget to indicate its new dimension
are now available.
This is what Q(Abstract)ScrollArea does internally anyway, so
even fixing the sizeHint and waiting for the event to trigger
again on the outer layout just costs another loop iteration
and results in multiple screen updates.
Since we need to adjust the width a few levels up, we need to
calculate the margins our self, but the layout is not overly
complex luckily.
BUG:409661
(cherry picked from commit 93bdd1d6f56092e2f229dc6202aa068f4526ddbc)