kconfig_compiler question: reusing the enum of a previous config entry
Albert Astals Cid
aacid at kde.org
Sun Mar 21 11:37:34 GMT 2021
El dissabte, 20 de març de 2021, a les 17:02:19 CET, David Hurka va escriure:
> Hi all,
>
> I am working on https://invent.kde.org/graphics/okular/-/merge_requests/366,
> where I am trying to get two config entries that use the same enum.
>
> The entry EnumColorMode defines an enum with values like “Normal” = 0 and
> “InvertLuma” = 6.
>
> I can reuse the enum in these two ways:
>
> 1. Write <choices name="Okular::SettingsCore::EnumRenderMode" />.
> This is documented as “It is also possible to [use] enums external to the
> generated class”, just that the enum is not actually external.
>
> 2. Write <choices name="EnumRenderMode" /> in all entries, and the first time
> define it as usual.
> This creates a global enum and then treats it as external enum.
>
> Both ways work, but don’t use the KConfigSkeleton::ItemEnum as I defined it.
> This means, instead of “InvertLuma”, it will write “6” to the config file.
>
> Is there a proper way to reuse the enum of a previous config entry?
Looking at KConfigXmlParser::readChoicesFromEntry and KConfigXmlParser::readGroupElements I don't think it's currently possible to reuse the choices from one entry to the other.
Cheers,
Albert
>
> Cheers, David
>
>
>
More information about the kde-core-devel
mailing list