PDA

View Full Version : qtscriptgenerator



ivareske
27th October 2010, 18:52
I can compile the qtscriptgenerator fine, but I am not able to import any of the extensions used.
I use:
qApp->addLibraryPath(path_toplugins); //I have added lots of different paths at the same time, the script folder/plugins folder etc. just to be sure
QScriptEngine *engine = new QScriptEngine(this);
QString libpaths = qApp->libraryPaths().join("\n");
qDebug()<<libpaths; //prints the paths I set
QString exts = engine->availableExtensions().join("\n");
qDebug()<<exts; // empty!!!!!!!!!!!!!!!!
QScriptValue tmp = engine->importExtension("qt.core"); // error: unable to import qt.core: no such extension

I`m using windows xp and Qt 4.6.3, mingw
Any ideas?

wysota
27th October 2010, 21:18
Did you copy the extensions to the appropriate place?

ivareske
27th October 2010, 21:35
Did you copy the extensions to the appropriate place?

Where is the appropriate place?
I thought it didn`t matter where they were as long as I set
qApp->addLibraryPath(path_toplugins);
to the place they are located. I am sure I have set the path to both the folder they are located and to one folder above where they are located, just in case.
The readme file of qtscripgenerator says:
"To use the plugins in your application, add the plugins path to the library paths
(QCoreApplication::setLibraryPaths()), then call QScriptEngine::importExtension()
(plugin keys are "qt.core", "qt.gui", etc)."

wysota
27th October 2010, 21:51
Where is the appropriate place?
I thought it didn`t matter where they were as long as I set
qApp->addLibraryPath(path_toplugins);
Yes, but it depends what you put in "path_toplugins". It should be the directory containing a subdirectory called "script" that contains the extensions. In other words you need to copy the extensions to $QTDIR/plugins/script where $QTDIR stands for your Qt installation directory.

ivareske
28th October 2010, 17:18
Yes, but it depends what you put in "path_toplugins". It should be the directory containing a subdirectory called "script" that contains the extensions. In other words you need to copy the extensions to $QTDIR/plugins/script where $QTDIR stands for your Qt installation directory.

I have done that, ensured that they are in a subdirectory with name "script". The files I have in the script folder are:

libqtscript_cored.a
libqtscript_guid.a
libqtscript_networkd.a
libqtscript_opengld.a
libqtscript_sqld.a
libqtscript_svgd.a
libqtscript_uitoolsd.a
libqtscript_xmld.a
libqtscript_xmlpatternsd.a
qtscript_cored.dll
qtscript_guid.dll
qtscript_networkd.dll
qtscript_opengld.dll
qtscript_sqld.dll
qtscript_svgd.dll
qtscript_uitoolsd.dll
qtscript_xmld.dll
qtscript_xmlpatternsd.dll


Are these maybe debug libraries?
Could there be an issue with mixing of release/debug libraries?
My app is compiled with CONFIG += qt release warn_on
I have compiled qtscriptgenerator as specified in the readme file, maybe I need to change something in the .pro files there to be release

wysota
28th October 2010, 17:46
Yes, they are debug libraries and will work only in debug mode.

ivareske
28th October 2010, 18:30
Yes, they are debug libraries and will work only in debug mode.

Thanks for helping, it worked now! Had to change debug_and_release to release in some .pro files in qtscriptgenerator

SONFEDAI
9th March 2014, 20:53
How to use script generator on android?

Is it possible?