Explanation:
a distance on a coordinate grid is always the Hypotenuse of a right-angled triangle with the differences of the x coordinates and the y coordinates as the legs.
so, per Pythagoras
distance² = (x diff)² + (y diff)²
we have here a distance 17. 17² = 289.
to get integer coordinates the lengths of the legs must be integer numbers.
what 2 squared integer numbers can be added to get 289 ?
I found after subtracting 4, 9, 16, 25, 36, 49 and finally 64 (the squares of 2, 3, 4, 5, 6, 7, 8) that
289 - 64 = 225, which is also a square number (15²).
so, we get the possible integer coordinates of Q to be
(-4 + 8, 7 + 15) = (4, 22)
in this case the shorter leg has the length 8, and the longer leg the length 15.
the shorter leg is in this case horizontal, because it is the x coordinate difference. and Q is again as described (4, 22).
if we make the shorter leg vertical, that means it is the y coordinate difference. and Q is then
(-4 + 15, 7 + 8) = (11, 15)