[PyQt] QSettings usage - multiple?

Baz Walter bazwal at ftml.net
Thu Oct 21 15:16:21 BST 2010


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\pos=@Point(794 473)
     window\size=@Size(400 400)
     ...

     [params-02]
     window\pos=@Point(794 473)
     window\size=@Size(400 400)
     ...



More information about the PyQt mailing list