tags:

views:

44

answers:

1

I'm writing a code for a voting machine that will allow user to read in custom XML ballots and then vote on them, however in the current build I have in QtCreator, I don't see an easy way to edit buttons in my GUI directly. In the code snippet below, I assign an element to pull out the names and type of ballot being read in, but I need to append a label on the GUI as well as change buttons to the names of candidates read in. Any ideas on how to do this?

 while(!n.isNull()){
    QDomNode x = n.firstChildElement();
    QDomElement e = n.toElement();
    QMessageBox::information(0,
            tr( "Loading Element" ),
            tr( "Our element is %1" ).arg(e.tagName()) );
            QDomElement p = x.firstChildElement();//p finds Races
                 QMessageBox::information(0,tr("Foo"),tr("p = %1").arg(p.text()));//finds Race and Ballot types

            n = n.nextSibling();
}

}

+1  A: 

All the widgets you created using the Designer UI are available from your code. How to access them depends on how you linked your UI with the rest of your classes (see http://doc.qt.nokia.com/4.6/designer-using-a-ui-file.html) but if you used the multiple inheritance approach your widgets and layouts will be accessible directly from your class using the name under which they appear in Designer. Qt Creator's completion will even work with them.

Having that in mind you can easily use the usual methods to change a widget's name, add a label to a layout, etc.

If this is still unclear, please add the code you use to embed your GUI, as it is needed in order to give you a sensible code example.

Gnurou