Setting preferredContentSize of QLPreviewingController breaks auto resizing

Following the answer here, I set the preferredContentSize of the QLPreviewingController.

This changes the window size as intended, but also seems to break subsequent auto resizing of all subviews. After setting it, the content will no longer track the preview window size when the user resizes it manually or enters fullscreen.

Any attempts to set view sizes, resizing masks or constraints programmatically after setting the preferredContentSize property will cause errors like
Code Block
NSServiceViewControllerWindow ... attempted to set frame of... from {...} to {...} and got {...}; set breakpoint on -[NSViewServiceMarshal actualFrame:differsFromSpecifiedFrame:oldFrame:ofWindow:] to catch this

and have no visible effect. Setting the breakpoint only tells me that the error is caused by trying to change the size of a view.
Answered by Dalaplan in 664565022
This seems to be a Catalina only bug (earlier versions do not support this kind of Quicklook extension.) Upgrading to Big Sur made it go away.
EDIT: Made a video to illustrate this problem: youtu.be/l7b1jq7pDWY
Original code is here: https://github.com/angstsmurf/spatterlight/blob/quicklook-ifiction/iFictionQuickLook/iFictionPreviewController.m
Accepted Answer
This seems to be a Catalina only bug (earlier versions do not support this kind of Quicklook extension.) Upgrading to Big Sur made it go away.
Setting preferredContentSize of QLPreviewingController breaks auto resizing
 
 
Q