Soprano.Util.SignalCacheModel

KDE 4.7 PyKDE API Reference

- KDE's Python API

# SignalCacheModel Class Reference

`from PyKDE4.soprano import *`

Inherits: Soprano.FilterModel → Soprano.Model → QObject
Namespace: Soprano.Util

## Detailed Description

\class SignalCacheModel signalcachemodel.h Soprano/Util/SignalCacheModel

Caches multiple signals into one to avoid slowdown when adding or removing many statements.

When adding or removing many statements with separate calls to Model.addStatement or Model.removeStatement Model emits signals Model.statementsAdded and Model.statementsRemoved over and over for each call. This can slow down an application that monitors the state of the model.

The SignalCacheModel caches multiple emitted signals into one, trying to ensure that only one signal is delivered in a certain time. The downside of this is that signals are not delivered immiadetely but through the event loop. This, however, should seldomly be a problem.

Author:
  Sebastian Trueg <trueg@kde.org>

Since:
  2.1

## Methods
| __init__ (self, Soprano.Model parent=0)
int | cacheTime (self)
| parentStatementsAdded (self)
| parentStatementsRemoved (self)
| setCacheTime (self, int msec)
| timerEvent (self, QTimerEvent event)

## Method Documentation

__init__ | ( | self, |
|  | Soprano.Model | parent=0
| ) |  |  |

Create a new SignalCacheModel.

Parameters:

  | parent | The parent Model to forward the actual calls to.

int cacheTime | ( |  | self ) |

The cache time. \sa setCacheTime

parentStatementsAdded | ( |  | self ) |

Reimplemented to do the actual signal caching.

parentStatementsRemoved | ( |  | self ) |

Reimplemented to do the actual signal caching.

setCacheTime | ( | self, |
|  | int | msec
| ) |  |  |

Signals are only delivered once every msec milliseconds.

Default value is 50

timerEvent | ( | self, |
|  | QTimerEvent | event
| ) |  |  |