PyANGKernel.GKPreferencesValues

class GKPreferencesValues

This class stores values for preferences attributes

Details

If GKPreferences stores the definition of which attributes are available, this class holds the values for these attributes.

Note that the value of an attribute can be defined in three places: the model, the system and the attribute itself as a default value. The application will ask for the value in the model using the method getPreferences() and then getValue . It no value is defined there the getValue will look in the system and if no value is in the system will get the default value stored in the attribute ( setDefault ).

Preferences values are set when edited with the GKPreferencesEditor.

<h2>Preferences change notification</h2>

There are two ways to know when a preferences object has been changed: - This object emits the signal GKPreferences::preferencesChanged. - It calls the method preferencesChanged method in all the objects that have been added to the interested list (use GKPreferences::addInterestedObject and GKPreferences::removeInterestedObject).

The first method is the preferred for classes that inherit from QObject (as they can use the signal/slot system). The second is reserved for classes that inherit from GKObject , that do not have access to this system.

See also

GKPreferences GKPreferencesEditor

Inheritance diagram of PyANGKernel.GKPreferencesValues

Synopsis

Methods

Signals

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

__init__()
addInterestedObject(obj)
Parameters:

objGKObject

Add an object to the list of objects that will be called when the preferences changes.

existsValue(name)
Parameters:

name – str

Return type:

bool

Returns true if a value has been defined for the attribute called “name” either at model level or system level.

getModel()
Return type:

GKModel

Get the model for this preferences or nullptr if they are system preferences

getValue(name)
Parameters:

name – str

Return type:

str

Return the value of attribute called “name”. If the attribute is not found this method return the value in the system or the default value set in when the attribute was defined ( setDefault ) is these are the attributes values for the system and the attribute id not found there too.

markPreferencesChanged()

Notify to this object that some changes have been made to it. It will emit the GKPreferences::preferencesChanged signal and will call the preferencesChanged method of all the interested objects.

preferencesChanged(preferences)
Parameters:

preferencesGKPreferencesValues

removeInterestedObject(obj)
Parameters:

objGKObject

Remove an object from the list of objects that will be called when the preferences changes. *

Warning

The specified object MUST be contained in the list of objects.

removeValue(name, modelOnly)
Parameters:
  • name – str

  • modelOnly – bool

If a value has been defined for the attribute called “name” either at model level or system level the value is removed and will no longer be available. * If modelOnly is true it will be removed at model level only, if found. If false it will be removed at the first level found (looking first at model and secondly at system level).

setDefinition(def)
Parameters:

defGKPreferences

Set the definition of the preferences values contained in this object. By default it takes the definition from the system ( getPreferencesDefinition() ). In this case this method do not have to be used. Use it only when accessing values that are not part of the system or model preferences.

setModel(model)
Parameters:

modelGKModel

Set the model in where this preferences are

setValue(name, value)
Parameters:
  • name – str

  • value – str

Set the value of an attribute called “name”. Note that before setting the value of an attribute it has to be defined in the GKPreferences .