Eneboo - Documentación para desarrolladores
|
The QSInputDialogFactory class extends QSA with a basic and easy-to-use input dialog framework. Más...
#include <qsinputdialogfactory.h>
Métodos públicos | |
QSInputDialogFactory () | |
QObject * | create (const QString &className, const QSArgumentList &arguments, QObject *context) |
The QSInputDialogFactory class extends QSA with a basic and easy-to-use input dialog framework.
To extend the interpreter with the Input Dialog Framework you need to create an instance of the QSInputDialogFactory and add it to the interpreter using the function QSInterpreter::addObjectFactory(). For example:
QSProject proj; QSInterpreter *ip = proj->interpreter(); ip->addObjectFactory( new QSInputDialogFactory );
The script extensions provided by the QSInputDialogFramework are described in detail in Input Dialog Framework
Note on threading; If the Input Dialog Factory is used with an interpreter running in the non GUI thread, all functionallity is disabled.
QSInputDialogFactory::QSInputDialogFactory | ( | ) |
Creates the input dialog factory. Use the function QSInterpreter::addObjectFactory to make the objects this factory represents to an interpreter.
QObject * QSInputDialogFactory::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.