Re: Re : KConfigXT generated class gets value from kdeglobals config file
On 09.08.2021 00:25, Carl Schwan wrote: when creating a KSharedConfig, you can specify if kdeglobals will be read and then you can tell KConfigXT that you want to read from an existing KSharedPtr:https://api.kde.org/frameworks/kconfig/html/kconfig_compiler.html Couldn't figure out how to use a KSharedPtr so I handled it another way https://invent.kde.org/multimedia/haruna/-/commit/268880dce01ec319265f3ee07ad1a563be2aab69
Re: Re : KConfigXT generated class gets value from kdeglobals config file
On 09.08.2021 00:25, Carl Schwan wrote: Hi, when creating a KSharedConfig, you can specify if kdeglobals will be read and then you can tell KConfigXT that you want to read from an existing KSharedPtr:https://api.kde.org/frameworks/kconfig/html/kconfig_compiler.html Thanks, I'll have a look. On another note, for color scheme handling in a QML app, this is how I did it in NeoChat:https://invent.kde.org/network/neochat/-/blob/master/imports/NeoChat/Settings/ColorScheme.qml andhttps://invent.kde.org/network/neochat/-/blob/master/src/colorschemer.h This allows the user to override the color scheme while using by default the system theme. That's not that different from what I'm doing at the moment https://invent.kde.org/multimedia/haruna/-/blob/master/src/application.cpp#L397 https://invent.kde.org/multimedia/haruna/-/blob/master/src/qml/Settings/General.qml#L235 And on my system NeoChat has the same problem, Config.colorScheme is also read from kdeglobals. In my case it is BreezeLight, but in the combobox it's called Breeze Light (with a space) resulting in currentIndex being -1, thus there is no selection for the combobox. Cheers, Carl
Re : KConfigXT generated class gets value from kdeglobals config file
Le dimanche 8 août 2021 à 11:15 PM, George Florea Banus a écrit : > In my app I'm using KConfigXT for my settings. > I have a general group and in it I have a ColorScheme entry. > Now when there is no ColorScheme set by the user and I try to access > this entry, instead of getting its default value it gets the value > stored in `~/.config/kdeglobals` (which also has a ColorScheme entry > under the General group). > https://invent.kde.org/multimedia/haruna/-/blob/master/src/settings/generalsettings.kcfg#L46 > https://invent.kde.org/multimedia/haruna/-/blob/master/src/settings/generalsettings.kcfgc > Any ideas how to prevent this? I'd rather not change the name of the > entry or the group. Hi, when creating a KSharedConfig, you can specify if kdeglobals will be read and then you can tell KConfigXT that you want to read from an existing KSharedPtr: https://api.kde.org/frameworks/kconfig/html/kconfig_compiler.html On another note, for color scheme handling in a QML app, this is how I did it in NeoChat: https://invent.kde.org/network/neochat/-/blob/master/imports/NeoChat/Settings/ColorScheme.qml and https://invent.kde.org/network/neochat/-/blob/master/src/colorschemer.h This allows the user to override the color scheme while using by default the system theme. Cheers, Carl