Skip to content

toolbarlayout: Buffer calls to calculateImplicitSize()

Arjen Hiemstra requested to merge work/ahiemstra/synctoolbarlayout into master

calculateImplicitSize() is called by ToolBarLayoutDelegate to update the implicit size after the delegate knows what its actual size is. However, since it needs the delegates to determine the size, it will call createDelegates() to update the list of delegates. This works fine if the delegate is properly async, unfortunately in some cases Qt will force the delegate creation into sync mode as there is no async incubation controller. This then creates an infinite recursion as ToolBarLayout does not yet know that the delegate exists and tries to create a new one.

To avoid that, rather than calling calculateImplicitSize() directly, queue a call and keep track of whether we queued it. This means we only re-run it after all sync creation is done and in addition it means we only run it once instead of for every delegate. It may even help the async case as that still has a chance of creating multiple delegates in one go.

BUG: 471286

Merge request reports