Application factory. This class uses a creator function to create new applications instances. The creator function corresponds to the traditionnal main() function for a web application. More...
#include <qwuiapplicationfactory.h>
Public Member Functions | |
QwuiApplicationFactory (QwuiApplicationCreator creatorFunction, const QStringList &args) | |
virtual | ~QwuiApplicationFactory () |
virtual QwuiAbstractResourceProvider * | create (const QString &sessionId) const |
Private Attributes | |
QwuiApplicationCreator | m_creatorFunction |
QStringList | m_args |
Application factory. This class uses a creator function to create new applications instances. The creator function corresponds to the traditionnal main() function for a web application.
// // the traditionnal main function only starts the application server. // int main(int argc, char** argv) { QCoreApplication app(argc, argv); QwuiApplicationServer webAppServer(webMain); webAppServer.setBuiltInServerPort(8888); webAppServer.exec(); return app.exec(); } // // This is the main function executed by the application server for each new session. // QwuiApplication* webMain(const QString& sessionId, const QStringList& args) { Q_UNUSED(args); QwuiApplication* webApp = new QwuiApplication(sessionId); QwuiMainWebget* mw = new QwuiMainWebget(NULL, "mw"); mw->setTitle("QtWui Test"); QwuiLabel* helloWorld = new QwuiLabel(mw, "helloWorld"); webApp->setMainWebget(helloWorld); helloWorld->setText("Hello World !"); return webApp; }
QwuiApplicationFactory::QwuiApplicationFactory | ( | QwuiApplicationCreator | creatorFunction, | |
const QStringList & | args | |||
) |
creatorFunction | creator function corresponding to the main() function for a web application. | |
args | command line arguments. |
QwuiApplicationFactory::~QwuiApplicationFactory | ( | ) | [virtual] |
QwuiAbstractResourceProvider * QwuiApplicationFactory::create | ( | const QString & | sessionId | ) | const [virtual] |
sessionId | Session identifier to use for the new application. |
Implements QwuiAbstractResourceProviderFactory.
QStringList QwuiApplicationFactory::m_args [private] |