On Thursday 21 October 2010, 16:16:21 Baz Walter wrote:
> On 20/10/10 14:22, Randy Heiland wrote:
> > Hello,
> >
> > Is it possible to have multiple QSettings files for an app? 
> > Basically, our situation is that we have an app and we save various
> > params associated with the app via the QSettings mechanism. 
> > However, we'd like to be able to save/read different sets of
> > params.  Perhaps we're mis-using the QSettings and should simply
> > save our app-specific params in a separate file?  I'd welcome
> > suggestions and example scripts.
>
> why not save multiple groups of params using the same settings
> object?
>
> so do something like:
>
>      settings.setValue("params-01/window/pos", self.pos())
>      settings.setValue("params-01/window/size", self.size())
>      ...
>
>      settings.setValue("params-02/window/pos", self.pos())
>      settings.setValue("params-02/window/size", self.size())
>      ...
>
> which would result in an ini file like:
>
>      [params-01]
>      window\p...@point(794 473)
>      window\si...@size(400 400)
>      ...
>
>      [params-02]
>      window\p...@point(794 473)
>      window\si...@size(400 400)
>      ...
>

Randy, you didn't express yourself very well, but probably Baz has hit 
the button. Usually, if people are after multiple config files, they 
try to establish a hierarchical configuration management.

Anyway, did you noticed the     

QSettings(const QString &fileName, Format format, QObject * parent = 0)

contructor. Because the config storage area differs significantly from 
OS to OS, it is not very popular. You have to carry the OS dependancy 
burden. 

Hth,
Pete
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to