That was a bad move for white to play. It's easy to win when your opponent throws the game.
No human player would trade queens in that situation.