I would use QDomDocumentfor this instead of QXmlStreamReader.
In your MainWindow constructor, create a simple QWidget instance and set it as the central widget. Add a layout of whatever type you want (grid, horizontal box, vertical box) depending on how you want the buttons laid out. If there are a lot of buttons, then you might want to use a QScrollArea as the central widget, and put the QWidget and layout inside that.
Read the XML into the QDomDocument (QDomDocument::setContent()), then use QDomDocument::elementsByTagName() to get a list of all of the "Room" nodes. Go through the list of room nodes, retrieve the ID and Name for each one. Create a QPushButton with the room name and insert it into the layout. Connect the button's clicked() signal to whatever slot you want to execute when the button is clicked. You can connect them all to the same slot, bcause you can use the sender() method to determine which button invoked the slot.
Bookmarks