The previous code was primarily there to work around misfeatures of OverlaySheet which no longer exist. Consequently, we don't have to leave in the hacks. Nice.
This further builds on the new OverlaySheet work done by Marco in https://commits.kde.org/kirigami/6f3800979f1387955ebd9c12aac031a9704853ae - resulting in the whole thing working much better, and with less client code. Nice.
BUG:419535