GammaRay  2.1.0
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
Typedefs | Functions
GammaRay::ObjectBroker Namespace Reference

Retrieve/expose objects independent of whether using in-process or out-of-process UI. More...

Typedefs

typedef QObject *(* ClientObjectFactoryCallback )(const QString &, QObject *parent)
 
typedef QAbstractItemModel *(* ModelFactoryCallback )(const QString &)
 
typedef QItemSelectionModel *(* selectionModelFactoryCallback )(QAbstractItemModel *)
 

Functions

void clear ()
 
bool hasSelectionModel (QAbstractItemModel *model)
 
QAbstractItemModel * model (const QString &name)
 
template<class T >
object (const QString &name, T=0)
 
template<class T >
object (T=0)
 
QObject * objectInternal (const QString &name, const QByteArray &type=QByteArray())
 
template<class T >
void registerClientObjectFactoryCallback (ClientObjectFactoryCallback callback, T=0)
 
void registerClientObjectFactoryCallbackInternal (const QByteArray &type, ClientObjectFactoryCallback callback)
 
void registerModelInternal (const QString &name, QAbstractItemModel *model)
 
void registerObject (const QString &name, QObject *object)
 
template<class T >
void registerObject (QObject *object)
 
void registerSelectionModel (QItemSelectionModel *selectionModel)
 
QItemSelectionModel * selectionModel (QAbstractItemModel *model)
 
void setModelFactoryCallback (ModelFactoryCallback callback)
 
void setSelectionModelFactoryCallback (selectionModelFactoryCallback callback)
 
void unregisterSelectionModel (QItemSelectionModel *selectionModel)
 

Detailed Description

Retrieve/expose objects independent of whether using in-process or out-of-process UI.

Function Documentation

void GammaRay::ObjectBroker::clear ( )

Clear all registered objects. Useful when the probe is deleted.

bool GammaRay::ObjectBroker::hasSelectionModel ( QAbstractItemModel *  model)

Checks whether a selection model for the given model is registered already.

QAbstractItemModel* GammaRay::ObjectBroker::model ( const QString &  name)

Retrieve a model by name.

template<class T >
T GammaRay::ObjectBroker::object ( const QString &  name,
= 0 
)

Retrieve an object by name implementing interface T.

Use this if multiple objects of the given type have been registered. Otherwise the function below is simpler and more failsafe.

NOTE: the "T = 0" is just to ensure a pointer type is given.

template<class T >
T GammaRay::ObjectBroker::object ( = 0)

Retrieve object implementing interface T.

This only works if a single type was registered implementing this interface using qobject_interface_iid as object name.

In most cases this is the simplest way for tools to get an object.

NOTE: the "T = 0" is just to ensure a pointer type is given.

QObject* GammaRay::ObjectBroker::objectInternal ( const QString &  name,
const QByteArray &  type = QByteArray() 
)

Retrieve object by name.

template<class T >
void GammaRay::ObjectBroker::registerClientObjectFactoryCallback ( ClientObjectFactoryCallback  callback,
= 0 
)

Register a callback for a factory of a given interface to create remote object stubs for the given type.

NOTE: the "T = 0" is just to ensure a pointer type is given.

void GammaRay::ObjectBroker::registerClientObjectFactoryCallbackInternal ( const QByteArray &  type,
ClientObjectFactoryCallback  callback 
)

Register a callback for a factory to create remote object stubs for the given type.

void GammaRay::ObjectBroker::registerModelInternal ( const QString &  name,
QAbstractItemModel *  model 
)

Register a newly created model with the given name.

NOTE: This must not be called directly by anything but the probe/server side. User code must use Probe::registerModel() instead!

void GammaRay::ObjectBroker::registerObject ( const QString &  name,
QObject *  object 
)

Register a newly created QObject under the given name.

void GammaRay::ObjectBroker::registerSelectionModel ( QItemSelectionModel *  selectionModel)

Register a newly created selection model.

QItemSelectionModel* GammaRay::ObjectBroker::selectionModel ( QAbstractItemModel *  model)

Retrieve the selection model for model.

void GammaRay::ObjectBroker::setModelFactoryCallback ( ModelFactoryCallback  callback)

Set a callback for the case that a model was requested but had not been registered before.

void GammaRay::ObjectBroker::setSelectionModelFactoryCallback ( selectionModelFactoryCallback  callback)

Set a callback for the case that a selection model was requested but had not been registered before.

void GammaRay::ObjectBroker::unregisterSelectionModel ( QItemSelectionModel *  selectionModel)

Unregisters a selection model. You have to take care of deletion yourself.


Klarälvdalens Datakonsult AB (KDAB)
"The Qt Experts"
http://www.kdab.com/
GammaRay
Qt-application inspection and manipulation tool
http://www.kdab.com/kdab-products/gammaray/