[Qt-interest] Data Storage for QT Application

Sean Harmer sean.harmer at maps-technology.com
Tue Feb 9 14:23:02 CET 2010


Hi,

On Tuesday 09 February 2010 13:05:23 Srdjan Todorovic wrote:
> On 09/02/2010, Chitrang Srivastava <chitrang.srivastava at gmail.com> wrote:
> > my data is Country/Capital pair and number of entries can go upto 10-20.
> >
> > setValue("Country/Name","France")
> > setValue("Country/Capital","Paris")
> > setValue("Country/Name","Japan")
> > setValue("Country/Capital","Tokyo")
> >
> > Now with QSetting it always overwrite the key Country/Name  with latest
> > value.
> 
> 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.

Sean



More information about the Qt-interest-old mailing list