KTutorial
0.5.1
|
Register to associate objects with an id. More...
#include <ObjectRegister.h>
Public Member Functions | |
ObjectRegister (QObject *parent=0) | |
Creates a new ObjectRegister with the given parent. | |
int | idForObject (QObject *object) |
Returns the id assigned to the object. | |
QObject * | objectForId (int objectId) |
Returns object associated to the id. | |
const QMetaObject * | metaObjectForClassName (const QString &className) const |
Returns the meta object with the given class name. | |
void | clear () |
Removes all the entries in this ObjectRegister. | |
void | registerMetaObject (const QMetaObject *metaObject) |
Registers a meta object and the meta objects of all its super classes. |
Register to associate objects with an id.
The id for an object is assigned after the first time the id is requested for that object, and are valid until the register is cleared or the object is destroyed (if an object is destroyed it is automatically removed from the register). The null object is a special case, and its id is always 0.
When an object is registered, its QMetaObject and the QMetaObject of all its super classes are also registered. The QMetaObject can be got using the class name since then until the register is cleared.
Its purpose is assign QObjects an id to allow the remote KTutorial editor to refer to the objects in the target application.
Definition at line 43 of file ObjectRegister.h.
ktutorial::editorsupport::ObjectRegister::ObjectRegister | ( | QObject * | parent = 0 | ) | [explicit] |
Creates a new ObjectRegister with the given parent.
parent | The parent QObject. |
Definition at line 27 of file ObjectRegister.cpp.
int ktutorial::editorsupport::ObjectRegister::idForObject | ( | QObject * | object | ) |
Returns the id assigned to the object.
object | The object to get its id. |
Definition at line 31 of file ObjectRegister.cpp.
References registerMetaObject().
Referenced by ktutorial::editorsupport::ObjectRegisterAdaptor::childObjectIds(), ktutorial::editorsupport::EditorSupport::findObject(), and ktutorial::editorsupport::EditorSupport::mainWindowObjectId().
const QMetaObject * ktutorial::editorsupport::ObjectRegister::metaObjectForClassName | ( | const QString & | className | ) | const |
Returns the meta object with the given class name.
className | The class name to get its meta object. |
Definition at line 56 of file ObjectRegister.cpp.
Referenced by ktutorial::editorsupport::ClassRegisterAdaptor::propertyList(), ktutorial::editorsupport::ClassRegisterAdaptor::signalList(), and ktutorial::editorsupport::ClassRegisterAdaptor::superClass().
QObject * ktutorial::editorsupport::ObjectRegister::objectForId | ( | int | objectId | ) |
Returns object associated to the id.
objectId | The id to get its associated object. |
Definition at line 52 of file ObjectRegister.cpp.
Referenced by ktutorial::editorsupport::ObjectRegisterAdaptor::childObjectIds(), ktutorial::editorsupport::ObjectRegisterAdaptor::className(), ktutorial::editorsupport::EditorSupport::highlight(), ktutorial::editorsupport::ObjectRegisterAdaptor::objectName(), and ktutorial::editorsupport::EditorSupport::stopHighlighting().
void ktutorial::editorsupport::ObjectRegister::registerMetaObject | ( | const QMetaObject * | metaObject | ) |
Registers a meta object and the meta objects of all its super classes.
metaObject | The meta object to register. |
Definition at line 67 of file ObjectRegister.cpp.
Referenced by ktutorial::editorsupport::ObjectRegisterAdaptor::className(), and idForObject().