Changing a Widget's name based on a string read in from an XML form in Qt.

Posted by Nick on Stack Overflow See other posts from Stack Overflow or by Nick
Published on 2010-06-14T20:28:48Z Indexed on 2010/06/14 20:32 UTC
Read the original article Hit count: 142

Filed under:
|
|

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();
}

}

© Stack Overflow or respective owner

Related posts about c++

Related posts about qt