PDA

View Full Version : how to insert item from XML file using readElementText to tablewidget



takechi
9th November 2010, 15:45
hi everybody
i try to code an example to read messages in qt designer. i searched in google but allmost is example for symbian and a don't understand it.
After grope in example of qt designer and i want to save all message in xml file with format

<?xml version="1.0" encoding="UTF-8"?>
<Example>
<MESS1>
<Content>123456789A 123456789B 123456789C 123456789D 123456789E 123456789F 123456789G 123456789H</Content>
<From>Admin</From>
<Time>25</Time>
</MESS1>
<MESS2>
<Content>noi dung 2</Content>
<From>Guess</From>
<Time>20</Time>
</MESS2>
<MESS3>
<Content>noi dung 3</Content>
<From>Guess</From>
<Time>20</Time>
</MESS3>
........
</Example>

and i used Qxmlstreamreader element to read content in xml file
but i don't know to display it to tablewidget
i want to make a simple example to read messages as inbox message in mobile .
when i run it all data will display in table widget with two column : From and Short content
like this
http://www.forum.nokia.com/piazza/wiki/images/d/d0/QtMessagesInBox.jpg
somebody help me One of the replies has an attachment with an example project for this problem :(

i just want to display data from xml file to tablewidget with 2 column and when i click in one row i can see the content of it.

A big thanks for everyone
regards
Newbie

takechi
10th November 2010, 14:18
<?xml version="1.0" encoding="UTF-8"?>
<Example>
<MESS1>
<Content>123456789A 123456789B 123456789C 123456789D 123456789E 123456789F 123456789G 123456789H</Content>
<From>Admin</From>
<Time>25</Time>
</MESS1>
<MESS2>
<Content>noi dung 2</Content>
<From>Guess</From>
<Time>20</Time>
</MESS2>
<MESS3>
<Content>noi dung 3</Content>
<From>Guess</From>
<Time>20</Time>
</MESS3>
<MESSn>
</Example>
one small questions when waiting for the first post , please help me.
how to count n mess from xml file with this format :-S
in symbian i found
for(int i = 0; i < messageIdList.count(); ++i)
to count idlist but in qt creator i don't know :(