This ensures the globalSelection is set correctly when focusing a tree widget. There are cases where when restoring the layout the global selection is not set because the widget is not yet active and when opening the context menu there is no selection changed event so the global selection stays at the old value. See the linked issue
How to test
Taken from the linked issue
Open a file
Click in the Navigator to give it focus (this is actually optional as long as the navigator is open)
Reload the window
Open the context menu for the already preselected file in the navigator widget
Follow-ups
Review checklist
[x] As an author, I have thoroughly tested my changes and carefully followed the review guidelines
What it does
Closes #12937
This ensures the globalSelection is set correctly when focusing a tree widget. There are cases where when restoring the layout the global selection is not set because the widget is not yet active and when opening the context menu there is no selection changed event so the global selection stays at the old value. See the linked issue
How to test
Taken from the linked issue
Follow-ups
Review checklist
Reminder for reviewers