This moves a fiddly little bit of logic used by a few UI
classes into a central location.
Also means that the paths dialog learns to expand the
first cell when it needs to (like the text variable
panel).
This allows us to switch back to a standard modal dialog (instead of
quasi-modal, which has problems with Ctrl-V in a search box inside a
standard file dialog -- such as when picking a path).
Fixes https://gitlab.com/kicad/code/kicad/issues/9473