RQModel¶
- class pyreaqtive.models.rqmodel.RQModel¶
Bases:
PyQt5.QtCore.QObjectRQModel Base Class.
All pyreaqtive models must inherit from this class, that provides basic get, set method and data changed signals
- rq_read_only = False¶
Indicates if the model cannot be written to. Set() raises error
- rq_data_changed¶
Data changed signal.
Widgets that are connected to models can connect slots to this signal. The model must emit to this when the state of it changes, to notify the widgets.
- _rq_delete¶
Delete signal.
Signals that the model instance is about to be deleted
- get()¶
Method to get the value of the underlying object.
Must be overridden by model
- Returns
value of the object
- Return type
Any
- set(value)¶
Method to set the value of the underlying object.
Must be overridden by model
- Parameters
value (Any) – New value of the model
- Return type
None
- __del__()¶
- Return type
None
- class pyreaqtive.models.rqmodel.RQComputedModel(function, **kwargs)¶
Bases:
objectRQComputedModel Base Class.
All pyreaqtive computed models must inherit from this class. Computed models are those that are calculated from others values, by means of a function. Changes in the linked models trigger events that updates linked widgets, than in turn calculate the function.
- Parameters
function (Callable) –
kwargs (pyreaqtive.models.rqmodel.RQModel) –
- __init__(function, **kwargs)¶
Constructor.
- Parameters
function (Callable) – function to calculate the model value from input values
**kwargs – reactive models in the function by variable name as keyword Changes in these models will trigger recalculation of the function
kwargs (pyreaqtive.models.rqmodel.RQModel) –
- _variable_changed()¶
Variable changed slot.
Called when some of the models have emitted rq_data_changed. Informs connected widgets that the function model has changed. Widgets will ask the value again and recalculate it with the new data
- Return type
None
- set(value)¶
- Parameters
value (Any) –
- Return type
None
- get()¶
Get value of the model in the output format of the function.
- Returns
function result with current model values
- Return type
Any