I'm curious if there's a way to do this with standard input instead of having to supply a filename?
I do this with man pages but it opens up in a full Preview window, not QuickLook.
You can use process substitution[0] to have a command output act as a file:
qlmanage -p <(man man) >/dev/null 2>&1
0 - https://www.gnu.org/software/bash/manual/html_node/Process-S... (it works in zsh too, but bash manual explains this feature more clearly)