madmurphy
(Madmurphy)
December 21, 2023, 12:59pm
1
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?
ebassi
(Emmanuele Bassi)
January 11, 2024, 10:24am
3
The proper way to do it is to install a property with the same name in your derived class.
1 Like
madmurphy
(Madmurphy)
January 11, 2024, 4:05pm
4
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()
?
ebassi
(Emmanuele Bassi)
January 11, 2024, 4:28pm
5
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
madmurphy
(Madmurphy)
January 11, 2024, 5:24pm
6
Perfect, thank you very much!
system
(system)
Closed
February 25, 2024, 5:24pm
7
This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.