Setting the Quick Look window focus when called programmatically

I have a situation where double tapping a trigger key (like Control) in the Finder brings up a floating window with a list of PDFs. If the user presses the space key, I use QLPreviewPanelMBS to bring up a Quick Look panel that displays the file’s content. A second press of the space key should close the Quick Look panel – but it doesn’t, because the Finder intercepts the key pressed event and opens its own Quick Look window. Only if I actually click my Quick Look pane does it receive key presses.

I’ve tried forcing it to accept keystrokes after it’s opened with things like myPreviewPanel.makeKeyAndOrderFront and its variants, but nothing works.

The question is, how can I change the key window from the Finder to the Quick Look window programmatically?