how is that checkmate

The King is in check by the Queen. The King cannot move to h8 because it would still be in check. The Queen is protected by the Bishop, so the King is unable to capture the Queen without ending up in check. Therefore it is check mate.

As I can see you don't see long ranged pieces, it's important to see these kinds of pieces because if you don't, you will mostly blunder a checkmate. Now back to the game, when the queen took the pawn, the king wasn't able to take the piece back, why? Because the bishop a long ranged piece and it was protecting the queen that controls lots of squares, due to the queen's power it was checkmate, make sure to practice chess to get better.