White has a check that requires inspection in Qh4. Notice its attractive properties: it plants the queen flush against Black’s king, but with protection; and (the new point) it aims White’s queen at Black’s queen, but with a White pawn between them—the kernel of a discovery. Black’s reply, Kf5, is forced. Now White plays the discovered attack g3-g4+. Black moves his king again. White plays QxQ next move. A moral: be careful not to neglect backward moves!
It's common enough for checking moves like Qh4 to create potential discovered attacks even if that possibility had nothing to do with your initial interest in the move. The important thing is to see the kernel of a discovery every time it is formed, even inadvertently. So when you imagine moving a piece for the sake of giving a check or for any reason, pay careful attention to the new lines it occupies and any possible discoveries you may be creating (or walking into) there. The practical cues are any pieces already on the lines running from the square you are planning to occupy.