I would think that the top picture is a serial printer cable, probably wired for ser2
The bottom picture looks like a serial mouse. You might get away with joining the two directly together. It would be better to open up the 25 way connectors and work out the connections first.
You would also need a serial mouse driver for the QL before it's likely to be of any use.
I don't know off hand how well RS232 drivers handle tying two outputs together, with one driving high, and one driving low. So you could blow up a driver IC.
Is there any point in having a mouse on a QL? Is there any software that uses it? The questions are slightly off topic but maybe the topic wouldn't exist if the answer is no point in a mouse.