I have been creating a 2D game in Qt and I want to allow others to connect to hosted games to play. Would I just make a "server" in the game and allow others to connect to it?
['https://Stackoverflow.com/questions/2277465', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/274437/']
Generally, one will need a few things to get something like that going.

Namely, a directory server. Maybe everyone connects to other players who host games to play, but you need to run a directory for games to be listed in order for people to connect.

Either that or you need to run a server and host them there. The choice is yours, the first option is probably easiest on you.
If I were you, I would make a server separated from, but bundled with, the "client". Believe me or not, many games out there take similar approach.