g GObject.ParamSpec GObject.ParamSpec

Subclasses:GObject.ParamSpecBoolean, GObject.ParamSpecBoxed, GObject.ParamSpecChar, GObject.ParamSpecDouble, GObject.ParamSpecEnum, GObject.ParamSpecFlags, GObject.ParamSpecFloat, GObject.ParamSpecGType, GObject.ParamSpecInt, GObject.ParamSpecInt64, GObject.ParamSpecLong, GObject.ParamSpecObject, GObject.ParamSpecOverride, GObject.ParamSpecParam, GObject.ParamSpecPointer, GObject.ParamSpecString, GObject.ParamSpecUChar, GObject.ParamSpecUInt, GObject.ParamSpecUInt64, GObject.ParamSpecULong, GObject.ParamSpecUnichar, GObject.ParamSpecValueArray, GObject.ParamSpecVariant


  get_blurb ()
  get_default_value ()
  get_name ()
  get_name_quark ()
  get_nick ()
  get_qdata (quark)
  get_redirect_target ()
  set_qdata (quark, data)
  sink ()
  steal_qdata (quark)

Virtual Methods

  do_finalize ()
  do_value_set_default (value)
  do_value_validate (value)
  do_values_cmp (value1, value2)


Name Type Access Description
flags GObject.ParamFlags r GObject.ParamFlags flags for this parameter
g_type_instance GObject.TypeInstance r private GObject.TypeInstance portion
name str r name of this parameter: always an interned string
owner_type GObject.GType r GObject.GType type that uses (introduces) this parameter
param_id int r  
qdata GLib.Data r  
ref_count int r  
value_type GObject.GType r the GObject.Value type for this parameter

Class Details

class GObject.ParamSpec

GObject.ParamSpec is an object structure that encapsulates the metadata required to specify parameters, such as e.g. GObject.Object properties.

Parameter names

Parameter names need to start with a letter (a-z or A-Z). Subsequent characters can be letters, numbers or a ‘-‘. All other characters are replaced by a ‘-‘ during construction. The result of this replacement is called the canonical name of the parameter.

Returns:the short description of self.
Return type:str

Get the short description of a GObject.ParamSpec.

Returns:a pointer to a GObject.Value which must not be modified
Return type:GObject.Value

Gets the default value of self as a pointer to a GObject.Value.

The GObject.Value will remain valid for the life of self.

New in version 2.38.

Returns:the name of self.
Return type:str

Get the name of a GObject.ParamSpec.

The name is always an “interned” string (as per GLib.intern_string()). This allows for pointer-value comparisons.

Returns:the GQuark for self->name.
Return type:int

Gets the GQuark for the name.

New in version 2.46.

Returns:the nickname of self.
Return type:str

Get the nickname of a GObject.ParamSpec.

Parameters:quark (int) – a #GQuark, naming the user data pointer
Returns:the user data pointer set, or None
Return type:object or None

Gets back user data pointers stored via GObject.ParamSpec.set_qdata().

Returns:paramspec to which requests on this paramspec should be redirected, or None if none.
Return type:GObject.ParamSpec

If the paramspec redirects operations to another paramspec, returns that paramspec. Redirect is used typically for providing a new implementation of a property in a derived type while preserving all the properties from the parent type. Redirection is established by creating a property of type GObject.ParamSpecOverride. See GObject.ObjectClass.override_property() for an example of the use of this capability.

New in version 2.4.

set_qdata(quark, data)[source]
  • quark (int) – a #GQuark, naming the user data pointer
  • data (object or None) – an opaque user data pointer

Sets an opaque, named pointer on a GObject.ParamSpec. The name is specified through a #GQuark (retrieved e.g. via GLib.quark_from_static_string()), and the pointer can be gotten back from the self with GObject.ParamSpec.get_qdata(). Setting a previously set user data pointer, overrides (frees) the old pointer set, using None as pointer essentially removes the data stored.


The initial reference count of a newly created GObject.ParamSpec is 1, even though no one has explicitly called g_param_spec_ref() on it yet. So the initial reference count is flagged as “floating”, until someone calls g_param_spec_ref (pspec); g_param_spec_sink (pspec); in sequence on it, taking over the initial reference count (thus ending up with a self that has a reference count of 1 still, but is not flagged “floating” anymore).

Parameters:quark (int) – a #GQuark, naming the user data pointer
Returns:the user data pointer set, or None
Return type:object or None

Gets back user data pointers stored via GObject.ParamSpec.set_qdata() and removes the data from self without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier.

do_finalize() virtual
do_value_set_default(value) virtual
Parameters:value (GObject.Value) –
do_value_validate(value) virtual
Parameters:value (GObject.Value) –
Return type:bool
do_values_cmp(value1, value2) virtual
Return type: