use a custom type id for python implementation

otherwise, QgsSettingsEditorWidgetRegistry is creating a wrapper for this setting type and expects the cpp implemetnation
(QgsSettingsEntryBaseTemplate and not QgsSettingsEntryBase)
This commit is contained in:
Denis Rouzaud 2024-10-08 22:19:49 +02:00
parent 1aa9a9ae6e
commit 08aeb133a0
No known key found for this signature in database
GPG Key ID: 92CF4C78D698D715
2 changed files with 18 additions and 2 deletions

View File

@ -59,6 +59,15 @@ class PyQgsSettingsEntryEnumFlag(QgsSettingsEntryBase):
parent = pluginName
super().__init__(key, parent, defaultValueStr, description, options)
def metaEnum(self):
return self.__metaEnum
def typeId(self):
"""
Defines a custom id since this class has not the same API as the cpp implementation
"""
return "py-enumflag"
def value(self, dynamicKeyPart=None):
"""
Get settings value.
@ -138,5 +147,4 @@ class PyQgsSettingsEntryEnumFlag(QgsSettingsEntryBase):
"""
Get the settings entry type.
"""
return self.SettingsType.EnumFlag

View File

@ -59,6 +59,15 @@ class PyQgsSettingsEntryEnumFlag(QgsSettingsEntryBase):
parent = pluginName
super().__init__(key, parent, defaultValueStr, description, options)
def metaEnum(self):
return self.__metaEnum
def typeId(self):
"""
Defines a custom id since this class has not the same API as the cpp implementation
"""
return "py-enumflag"
def value(self, dynamicKeyPart=None):
"""
Get settings value.
@ -138,5 +147,4 @@ class PyQgsSettingsEntryEnumFlag(QgsSettingsEntryBase):
"""
Get the settings entry type.
"""
return self.SettingsType.EnumFlag