Eneboo - Documentación para desarrolladores
|
#include <AQSObjectFactory.h>
Métodos públicos | |
AQSObjectFactory () | |
~AQSObjectFactory () | |
QObject * | create (const QString &className, const QSArgumentList &arguments, QObject *context) |
Métodos públicos estáticos | |
static QObject * | staticCreate (const QString &className, const QSArgumentList &arguments, QObject *context, QMap< int, QStringList > *candidateCtors=0) |
AQSObjectFactory::AQSObjectFactory | ( | ) |
AQSObjectFactory::~AQSObjectFactory | ( | ) |
QObject * AQSObjectFactory::create | ( | const QString & | className, |
const QSArgumentList & | arguments, | ||
QObject * | context | ||
) | [virtual] |
This virtual function should be reimplemented in your QSObjectFactory subclass when you want to instantiate objects from script. The subclass can be used to create any number of different classes. The name of the required class is passed in the className argument, and the arguments to be passed to that class's constructor are passed in the arguments list. See QSArgument for further information about the arguments. context is the script QObject context in which the class has been instantiated, or 0 if the class has not been instantiated in a QObject context.
Only QObject subclasses may be created in this way. This function returns an instance of the requested class.
This function is called by the scripting engine, e.g. when it encounters code similar to the following:
var x = new ACppObject( arg1, arg2 ); // Qt Script
The classes that a particular QSObjectFactory instance is capable of instantiating is returned by classes().
If the arguments are invalid or any other invalid operation happens, you can use throwError() to issue a Qt Script error.
All objects created from this function are deleted by the engine when the engine registers it as not being referenced anymore, unless the object at this time has a parent, which will then be responsible for ownership.
Reimplementado de QSObjectFactory.
QObject * AQSObjectFactory::staticCreate | ( | const QString & | className, |
const QSArgumentList & | arguments, | ||
QObject * | context, | ||
QMap< int, QStringList > * | candidateCtors = 0 |
||
) | [static] |