[Qt-interest] Data Storage for QT Application

André Somers andre at familiesomers.nl
Tue Feb 9 19:59:41 CET 2010


It really sounds like a perfect job for using SQL, but if you find that
overkill, just use a simple QFile like was suggested below. SQLite is small
and self-contained, but a bit more work to implement than just using a QMap
with your pairs, and reading and writing that to/from a file with
QDataStream since your list is small anyway. If SQL is overkill for you,
then so is XML, IMHO.

The QMap solution supports all you want, all you need to do is just write
out your modified QMap again. If you only have a few dozen pairs, that will
be done in no time at all. If you go for an XML based solution, you’ll have
the same issue. Only SQL is more efficient there, but for so little rows,
it’s hardly worth the effort IMO.

 

André

 

Van: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] Namens Chitrang Srivastava
Verzonden: dinsdag 9 februari 2010 18:42
Aan: Srdjan Todorovic
CC: qt-interest at trolltech.com
Onderwerp: Re: [Qt-interest] Data Storage for QT Application

 

Hello Friend,

I see their is lot of other options suggested by esteemed members.

Let me put my requirements first.
record means (Country name,capital, )

Add a record.
Delete a record(row), based on Country name(A country name will be given
search the record in table & delete the whole row).
Retrieve all the records(whole table ).

I see that QSettings cant solve this problem fully (retrive row based on a
value wouldn't possible).
I will try XML ; guess needs to create domtree ; query/add /modify and write
back to xml file.
Any other suggestion ?

-chits

On Tue, Feb 9, 2010 at 7:00 PM, Srdjan Todorovic
<todorovic.s at googlemail.com> wrote:

On 09/02/2010, Sean Harmer <sean.harmer at maps-technology.com> wrote:
> On Tuesday 09 February 2010 13:05:23 Srdjan Todorovic wrote:

>> How about:
>>   setValue("Country_01/Name","France");
>>   setValue("Country_01/Capital","Paris");
>>   setValue("Country_02/Name","Japan")
>>   setValue("Country_02/Capital","Tokyo")
>>
>> And you could even have a count saved:
>>   setValue("NumberOfEntries","2");   or similar.
>>
>> You can do this in a loop. Does that help?
>
> Or you could even use the begin{Read|Write}Array()/endArray() functions of
> QSettings and let that do it for you.

Thanks for that tip. Sadly that's not implemented in my QSettings.
Hopefully it is for the OP.

Srdjan

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100209/07531887/attachment.html 


More information about the Qt-interest-old mailing list