When viewing a file with QuickLook it will appear in the foreground of the screen. When you select a different window, QuickLook will go to the background. It’s possible to keep the QuickLook windows in front.
defaults write com.apple.Finder QLHidePanelOnDeactivate 0
Restart Finder to make changes effect.
Revert the change with:
defaults write com.apple.Finder 1