How to change qtsoftware.conf file location from etc/xdg location to user specific location
-
wrote on 24 May 2023, 07:10 last edited by
Hi Team,
I am using Qt5.12.2 version(OS is RHEL 8.4), in which qtsoftware.conf file is getting created by default in etc/xdg location. My client raised an objection and dont want to give permissions to etc/xdg folder, how can i change the default location of qtsoftware.conf to user specific config location.
-
Hi Team,
I am using Qt5.12.2 version(OS is RHEL 8.4), in which qtsoftware.conf file is getting created by default in etc/xdg location. My client raised an objection and dont want to give permissions to etc/xdg folder, how can i change the default location of qtsoftware.conf to user specific config location.
@Krishna-B if you mean a file created by QSettings then just use one of the constructors which allows you to specify a path to settings file: https://doc.qt.io/qt-6/qsettings.html#QSettings-3
-
Hi Team,
I am using Qt5.12.2 version(OS is RHEL 8.4), in which qtsoftware.conf file is getting created by default in etc/xdg location. My client raised an objection and dont want to give permissions to etc/xdg folder, how can i change the default location of qtsoftware.conf to user specific config location.
wrote on 24 May 2023, 07:41 last edited by@Krishna-B
Since it's not part of Qt distribution it would be helpful if you gave a link to the QtService code you are using.It seems that it uses the
QSettings::SystemScope
location for its/conf
file. I think either you would have to change the source to affect that, or you would have to alter what that points to, e.g. as per example in https://docs.huihoo.com/qt/solutions/4/qtservice/qtservice-example-interactive.html.Check that
/etc/xdg
is indeed the value currently returned for yourQSettings::SystemScope
. Whether that is the "correct" location for a service which may not be interactive/use a desktop I don't know.If you change this system scope you need to think about other code in the application which e.g. may be reading from there, since it now points to a different location.
-
@Krishna-B
Since it's not part of Qt distribution it would be helpful if you gave a link to the QtService code you are using.It seems that it uses the
QSettings::SystemScope
location for its/conf
file. I think either you would have to change the source to affect that, or you would have to alter what that points to, e.g. as per example in https://docs.huihoo.com/qt/solutions/4/qtservice/qtservice-example-interactive.html.Check that
/etc/xdg
is indeed the value currently returned for yourQSettings::SystemScope
. Whether that is the "correct" location for a service which may not be interactive/use a desktop I don't know.If you change this system scope you need to think about other code in the application which e.g. may be reading from there, since it now points to a different location.
-
@Krishna-B
Since it's not part of Qt distribution it would be helpful if you gave a link to the QtService code you are using.It seems that it uses the
QSettings::SystemScope
location for its/conf
file. I think either you would have to change the source to affect that, or you would have to alter what that points to, e.g. as per example in https://docs.huihoo.com/qt/solutions/4/qtservice/qtservice-example-interactive.html.Check that
/etc/xdg
is indeed the value currently returned for yourQSettings::SystemScope
. Whether that is the "correct" location for a service which may not be interactive/use a desktop I don't know.If you change this system scope you need to think about other code in the application which e.g. may be reading from there, since it now points to a different location.
wrote on 25 May 2023, 06:27 last edited by@JonB Hi, in my qtservices code default QSetting::systemscope is set. In my service by using setPath of QSettings i am able to generate qtsoftware.conf in specified location. But my service is not listing or showing as registered service. What else do i need to do to achieve this. Thanks in advance!!
-
@JonB Hi, in my qtservices code default QSetting::systemscope is set. In my service by using setPath of QSettings i am able to generate qtsoftware.conf in specified location. But my service is not listing or showing as registered service. What else do i need to do to achieve this. Thanks in advance!!
wrote on 25 May 2023, 06:34 last edited by@Krishna-B
You are asking about a third-party QtService, about which I know nothing. I know where "services are registered" under Windows, I don't even know where/how you have "services" under Linux, I only know what "daemons" are there. Is there code in this QtService which (tries to) do whatever under Linux/RHEL to "register as a service"? -
wrote on 30 May 2023, 13:35 last edited by
Thank you all for the immediate response, with the change in QtService (QSettings::systemscope to QSettingS("OrgID", QtSoftware) able to generate QtSoftware.conf in user scope .config folder.
1/7