Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // a) konverze na QObject
- this->supernova = new QScriptEngine(dynamic_cast<QObject*> (this));
- printf("%p->%p", this, this->supernova->parent());
- qDebug() << this << this->supernova->parent(); // NsProcess(0x82eb9b8) NsProcess(0x82eb9b8)
- // b) předání
- QScriptValue constructorFile(QScriptContext *context, QScriptEngine *engine)
- {
- QObject *object = new API::File(engine->parent(), context);
- return engine->newQObject(object, QScriptEngine::ScriptOwnership);
- }
- // c) konverze na NsProcess
- File::File(QObject *engine, QScriptContext *args) : QObject()
- {
- this->ps = dynamic_cast<NsProcess*> (engine->parent());
- printf("%p->%p", engine->parent(), this->ps);
- qDebug() << engine->parent() << this->ps; // QObject(0x0) QObject(0x0)
- }
- // crash
- QString File::doSomething()
- {
- this->ps->IO->writeLine("The method File::doSomething() has been called.");
- return "I'm doing something cooler than you are!";
- }
Add Comment
Please, Sign In to add comment