PDA

View Full Version : Dynamically creating buttons from Xml file



chandru@080
25th November 2010, 07:39
Hello,

I want some leads to create an application, I want to dynamically create buttons from xml files

it will be great if somebody could help me on this.

Lykurg
25th November 2010, 08:21
What have you tried so far? What problems do you exactly face? And do you really think this question belongs to the Qt Programming forum? (-> Moved to newbie)

chandru@080
25th November 2010, 08:32
i am just a new person in QT. so dont have much of info on this.. just learning QT basics,.

I really dint know that this query has to be put in the newbie forum. I havent done much right now. i created some application which creates buttons dynamically but not from files.. so just wanted to know how it can be done.

Lykurg
25th November 2010, 08:44
So what informations do you have in those files? And if you are able to create buttons dynamically then have a look at QFile on how to read a file or if it is XML see QDomDocument. Then loop over the lines/tags and create the buttons.

chandru@080
25th November 2010, 08:58
Ya i tried creating buttons through files and dint have any problem. i wanted to know which class to use to call xml files to create controls dynamically. thanks for giving me some leads. i will have a look at the class and do some research.

FelixB
25th November 2010, 10:34
there is no class which does "read an xml file and create buttons". you have to code that by yourself - nobody knows the structure of your xml file! So, you have to parse the file using suggested QDomDocument. Then, create a button if you reached a button description in the file.