[Interest] using QSetting when host application is using it as well

Frank Rueter | OHUfx frank at ohufx.com
Thu Feb 2 04:51:48 CET 2017


Hi all,

I have been using QSettings for reading/writing user settings.
All works well until I run my (PySide) application inside a host 
application that is also written in QT, and which also uses the 
QSettings object.

I am now struggling to understand how I can properly differentiate 
between the host application's settings instance and my own.
In particular, I need to use QSettings().fileName() to determine the 
correct support path for my ini files for each platform.
But this line gives me different values inside and outside the host 
application:

    QtCore.QSettings(QtCore.QSettings.IniFormat,
    QtCore.QSettings.UserScope, "companyName", "appName").fileName()

E.g.:
Outside the host application I get what I want:

    /Users/frank/.config/companyName/appName.ini

But the return value is a completely different inside the host app and 
actually points to the host app's internal file structure.
Fair enough too I guess.

So my question is:
How can I use QSettings to determine support paths etc while making sure 
that I don't accidentally mess with the host applications QSettings?

Cheers,
frank
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170202/7ca1de76/attachment.html>


More information about the Interest mailing list