GObject: overriding properties using different flags

Let’s imagine that I have class A derived from GObject and class B derived from class A.

Let’s imagine that class A has property named "foo-bar" declared as G_PARAM_CONSTRUCT_ONLY | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS.

Can class B override "foo-bar" declaring it as, for instance, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS?

If yes, what is the correct way to override changing flags in the process?

Anyone who can help?

The proper way to do it is to install a property with the same name in your derived class.

1 Like

Thank you, Emmanuele. You mean writing, let’s say, g_param_spec_pointer() (or any other g_param_spec_*() function) instead of writing g_object_class_override_property()?

Yes, that’s what I meant.

Property overrides are only meant to be used by a class implementing an interface that defines one or more properties.

1 Like

Perfect, thank you very much!

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.