PDA

View Full Version : Where is QScriptable in Qt5.2.1



TorAn
28th February 2014, 19:00
I am porting an old project from qt4.7.3 to qt5.2.1 (windows). Compiler complains that it can't find any of the QtScript* includes


#include <QScriptable>
#include <QStringList>
#include <QScriptContext>
#include <QScriptEngine>
#include <QScriptValue>
#include <QScriptTools>

quick review of the source tree under qtbase\include shows that under QtScript folder there is a single file, QtScriptDepends, and not QScript. Same with QtScriptTools folder.

What is going on? Where are script includes now? Any help will be greatly appreciated.

Thanks.

anda_skoa
1st March 2014, 14:33
Hmm, how did you install Qt?

Built from sources? If so have you built and installed the qtscript module?

Cheers,
_

d_stranz
1st March 2014, 17:10
I have found that, on Windows with MSVC builds, many of the modules beyond the standard core are not built using the recommended configure / nmake steps. The unfortunate thing is because "nmake install" is totally broken, even after you build the extra modules manually getting them installed correctly is a real pain.

Note for those who keep their heads buried firmly in the Qt sandbox: Qt Creator / qmake / jom aren't the solution for a lot of us and it is sad that the Qt-Project folks won't accept that and put more effort into getting nmake builds fixed.

TorAn
2nd March 2014, 00:11
Thanks for the replies! No, I did not built it separately, never had to do it :).
Do you know where I can find the instructions of how to build it on windows?

Thanks

anda_skoa
2nd March 2014, 01:56
Hmm. I thought you were building yourself since you wrote you had looked into a source folder (qtbase\include)

So you installed using one of the pre-built installers?

Have you checked in the install path?

Does your .pro file contain "script" in the QT line?

Cheers,
_

wysota
2nd March 2014, 14:25
How is your problem related to this thread?

TorAn
2nd March 2014, 16:55
Sorry, I asked question first and looked in the source tree second :).

Then I compiled qtscript. No more issues with it, sorry. And thanks for the help and quick responses!

TorAn
30th April 2014, 07:45
This problem with QtScript is following me around :).

I had to rebuild Qt5.2.1 from sources. My Qt sources are installed in c:\Libraries\Qt\Qt5.2.1 Next, I rebuilt qtScript (located in c:\Libraries\Qt\Qt5.2.1\qtscript\qtscript.pro. And now my project that used to compile with qtscript includes is giving me compilation errors (can't find qtscript header files).

My question is:
The include paths in my project settings are $(QTDIR)\include\QtScript and $(QTDIR)\include\QtScriptTools, where $(QTDIR) is c:\Libraries\Qt\Qt5.2.1\qtbase.
But the qtscript.pro builds all includes in c:\Libraries\Qt\Qt5.2.1\qtscript\include. Changing include paths in my project to point to c:\Libraries\Qt\Qt5.2.1\qtscript\include does not help, i.e compiler does not find other qscript-dependent header.

What are the right steps to build qtscript in Qt5.2.1 and which includes to use in the project?

ChrisW67
30th April 2014, 08:41
The Qt scripting support is shipped as a standard part of the official Qt5 binaries.
A default build from a source tar ball should have built the qtscript module.

Once you have a Qt5 with the scripting module then you enable it on your project file with:


QT += script

This is documented at the top of QT 5 class documentation pages such as QScriptable (http://qt-project.org/doc/qt-5/qscriptable.html). No other manual INCLUDEPATH or LIBS settings are required.

TorAn
30th April 2014, 14:29
Thank you. Since for this particular project I am using vs2013 I neglected to try to compile test project in QtCreator. Indeed, it compiles just fine. Looking into the list of includes in compile output I realized what the problem was. QtScript is included from four places, and when I added paths to VS that mimics the one in Qt everything worked.
c:\Libraries\Qt\Qt5.2.1\qtscript\include
c:\Libraries\Qt\Qt5.2.1\qtscript\include\QtScript
$(QTDIR)\include\QtScript