[Qt-interest] Data Storage for QT Application

André Somers andre at familiesomers.nl
Fri Feb 5 08:38:08 CET 2010


(sorry, copy to list)

 

What’s wrong with just using a file? You can use QTextStream to read and
write it. Depending on the details of your application, you can use comma or
tab separation of the strings on your row, or use some other scheme you
dream up, like a simple one string per line. How many of these strings do
you need to store? 10? 100? 1000? 100,000? That also has an influence on
your choice of course


 

XML seems like overkill to me. That’s nice if you want to work with
structured data with different types, and/or want to be able to deal with
extensions nicely, but it seems you don’t need all that.

 

André

 

 

Van: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] Namens Chitrang Srivastava
Verzonden: vrijdag 5 februari 2010 6:49
Aan: Ross Driedger
CC: qt-interest at trolltech.com
Onderwerp: Re: [Qt-interest] Data Storage for QT Application

 

Thanks all, QSettings looks to be a favourite option.
I will look at the API description , 
Can you guys points to some example.

>From what I read of QSetting it is used to save settings and then retrive
based on specific key.
In may case their is no key.
Its like this.All are string data.At application start I want to read the
data and populate some UI component.Also need to delete any particular row
or add another row.I know XML is one way but some how I found their API to
be bit cryptic .
Can this be done using QSettings?

A1 B1 C1
A2 B2 C2
A3 B3 C3

Thanks
-Chitrang

On Thu, Feb 4, 2010 at 11:43 PM, Ross Driedger <ross at earz.ca> wrote:

 

On 4-Feb-10, at 12:03 PM, qt-interest-request at trolltech.com wrote:






Message: 1
Date: Thu, 4 Feb 2010 21:25:34 +0530


From: Chitrang Srivastava <chitrang.srivastava at gmail.com>

Subject: [Qt-interest] Data Storage for QT Application

To: qt-interest at trolltech.com

Message-ID:
         <75ad89fd1002040755k357f4a67h581a54941a8b242b at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"



Hi,

I want to store/modify  some data in my application which i want to persist
across application instances i.e. when I close and re-open application I can
see modified data.

 

Assuming that the data is not part of a document and is really not suited to
QSettings,I suggest that you have a simple XML file that is loaded on
program start and written on program exit.

 

But first, I would consider using QSettings, because keeping multiple
support and configuration files can turn into a head-ache.






I check API , I guess I can use Qt-XML or QSqlDatabase.
Qt-XML  API are a bit confusing so I want to avoid it.
QSqlData is bit too much for my app , I have just 3 string per row.

 

The QSql module is actually pretty lean compared t other XML
implementations.  Once you get used to it, it's a very effective way of
doing this sort of thing. 

 

 

Ross Driedger

ross_at_earz.ca

 

 

 

 


_______________________________________________
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/20100205/f95ef2b1/attachment.html 


More information about the Qt-interest-old mailing list