Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.12.7
-
None
Description
We have window system where a main widget holds a view widget which can be split by pressing a button. When this is done two new main widgets are created in each side of a QSplitter, the initial view is parented to one of the new widgets and a new view added to the other, and the QSplitter parented to the main widget.
Part of the view widget is a button which pops up a menu. The menu position is based on the global position of the button, such that it appears just below it. In the initial view, this works fine. After the view has been split, the menu appears correctly only for the right-hand view; for the left-hand view, the menu is offset by the global position of the button. This continues as more views are split - the last view is always correct, but the others have increasing offsets.
This issue seems to resolve itself if the widgets are added to the QSplitter before the QSplitter is added to the layout of the main widget.
See attached example. Click the "Menu" button - menu appears just below the button. Click "Split". Press the right-hand "Menu" button - menu appears just below the button. Press the left-hand "Menu" button - menu appears offset. Split again, repeat - menus are progressively further from the correct position.
Moving line TestWidget.cpp:59 to TestWidget.cpp:62 fixes the issue.