I have a QMenu with an embedded widget (provided by a QWidgetAction). The content of the embedded widget is updated between showings of the menu which could cause the size of the embedded widget to change.
It appears to me that when the menu tries to calculate its new size for the next show the widget's layout has not been updated to reflect the new required size because the updates are applied while the widget was not visible. The widget's sizeHint is not updated until it is actually shown, too late to influence the size of the menu. Consequently, the menu uses the stale size of the widget, and the size of the menu is always lagging behind the size of the widget by one update cycle.
I was thinking if I could force the widget to update its layout (really its sizeHint) prior to being shown, the QMenu could obtain the correct sizeHint from the widget.
Bookmarks