The next thing to do is to allow to store and read player names from outside the dialog—since the ui component is private, there is no access to it from outside the class code. This is a common situation and one that Qt is also compliant with. Each data field in almost every Qt class is private and may contain accessors (a getter and optionally a setter), which are public methods that allow us to read and store values for data fields. Our dialog has two such fields—the names for the two players.
Names of setter methods in Qt are usually started with set, followed by the name of the property with the first letter converted to uppercase. In our situation, the two setters will be called setPlayer1Name ...