PyANGKernel.GKPreferencesGroup

class GKPreferencesGroup

A collection of preference’s groups and attributes.

Details

A preferences group is a holder for attributes. It groups attributes that are related and is used, also, to control how attributes will be shown to the user in the GKPreferencesEditor.

A group can be only relevant for the whole system, for a particula model or for both. The scope ( setScope ) defines is a preference group will be visible and editable in system or/and in model preferences. By default a group is editable in both.

And example of group creation follows:

subgroup = new GKPreferencesGroup();
subgroup->setName( "GKModel::LanguageGroup" );
subgroup->setExternalName( QObject::tr("Language") );
subgroup->setEditorPlace( GKPreferencesGroup::eBox );
group->addGroup( subgroup );

Synopsis

Methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

class GKPreferencesEditorPlace
__init__()
addAttribute(attribute)
Parameters:

attributeGKPreferencesAttribute

Add a new attribute to this group. If the attribute was already in the group (searching by name) it will not be added.

The pointer to the attribute is adopted.

addDisableCondition(attr, value)
Parameters:
addGroup(group)
Parameters:

groupGKPreferencesGroup

Add a new group to this group. If the group was already in the group (searching by name) it will not be added.

The pointer to the group is adopted.

addNewAttribute()
Return type:

GKPreferencesAttribute

Creates and adds a new attribute to this group. It is returned.

getAttribute(name)
Parameters:

name – str

Return type:

GKPreferencesAttribute

Get an attribute by name looking in this group and its subgroups. If no attribute is found it returns nullptr.

getAttributes()
Return type:

.list of GKPreferencesAttribute

Returns all the attributes in this group.

getDisableConditions()
Return type:

.list of std.pairGKPreferencesAttribute,QString

getEditorPlace()
Return type:

GKPreferencesEditorPlace

Returns the place in the editor for this group.

getExternalName()
Return type:

str

Get the external name of this object.

getGroup(name)
Parameters:

name – str

Return type:

GKPreferencesGroup

Get a group by name looking in this group and its subgroups. If no group is found it returns nullptr.

getGroups()
Return type:

.list of GKPreferencesGroup

Returns all the groups in this group (not recursively).

getName()
Return type:

str

Get the name of this object.

getPriority()
Return type:

int

Gets the priority of this group related to other siblings groups. Used to show the groups in order.

See also

sort

isModelScope()
Return type:

bool

Can this group be edited and view in the Model preferences?

isSystemScope()
Return type:

bool

Can this group be edited and view in the System preferences?

removeAttribute(attribute)
Parameters:

attributeGKPreferencesAttribute

Return type:

bool

Removes an attribute from this groups. The attribute object is deleted (no use of it can be done after this call).

removeGroup(group)
Parameters:

groupGKPreferencesGroup

Return type:

bool

Removes a group from this group. Any attribute and group inside it will be removed too. The group object is deleted (no use of it can be done after this call).

setEditorPlace(position)
Parameters:

positionGKPreferencesEditorPlace

Set in which place a group will appear in the GKPreferencesEditor.

setExternalName(aname)
Parameters:

aname – str

Set the external name of this object. This name will be used to label this attribute when it is presented to the user.

setName(aname)
Parameters:

aname – str

Set the name for this object. Must be unique. Is it resposibility of the developer to ensure that it is unique.

setPriority(level)
Parameters:

level – int

Sets the priority of this group related to other siblings groups. Used to show the groups in order.

See also

sort

setScope(system, model)
Parameters:
  • system – bool

  • model – bool

Defines the scope (where it can be used) of this group.

sort()

Sort the groups in this group (if any) by priority (from low to high priority). A lower number means that will be presented first.

Sub groups will be sorted too (so calling sort will sort everything)

The default priority value is 100. GKKernel and GGui preferences will use priorities lower than 100. Plug-ins should use priorities greater (or equal) than 100.

takeAttribute(attribute)
Parameters:

attributeGKPreferencesAttribute

Return type:

bool

Removes an attribute from this group but no data is deleted. Use this method to move an attribute from its location inside a group to a new one.

takeGroup(group)
Parameters:

groupGKPreferencesGroup

Return type:

bool

Removes a group (an any group and attribute inside) from this group but no data is deleted. Use this method to move a group from its location inside a group to a new one.