Skip to content

QMainWindow: fix restoreState() for toolbars

Restoring the toolbar state of a QMainWindow could not update QWidgetPrivate::widgetItem for the QToolBar, because at that point it was still holding the pointer to the widgetItem of the previous state. Later on, when the new state was successfully applied, the previous state was deleted, and the corresponding widgetItem was reset to nullptr.

This patch explicitly resets the QToolBar's widgetItem while updating the state, so that it is later correctly updated while creating a new QWidgetItemV2.

Fixes: QTBUG-102395 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I17613d62423edcc0faf85ecb0a714865a50d87e8 Reviewed-by: Volker Hilsheimer volker.hilsheimer@qt.io (cherry picked from commit 2ed54ded)

Merge request reports