PDA

View Full Version : Using Qt classes in QtScript



totem
7th March 2011, 21:47
I'm trying to use Qt classes directly in QtScript



function Script ()
{
var rect = new QRectF(0,0,10,5) ;
var polygon = new QPolygonF(rect) ;
level.addPolygon(polygon);
}

function entry_point()
{
Script() ;
}


When I evaluate the entry_point() function, this gives me :


ReferenceError: Can't find variable: QRectF

Does anybody can tell me what I'm missing (must be obvious) ?
If I can't use Qt this way, is there a solution ?

wysota
7th March 2011, 22:30
You need to generate wrappers for Qt classes. There is a tool on Qt Labs to do this.

totem
8th March 2011, 08:31
Thank you for the pointer :)

i found that tool, called Qt Script Generator (http://qt.gitorious.org/qt-labs/qtscriptgenerator)

totem
8th March 2011, 13:44
I'm a bit confused regarding the terms of use of Qt Script Generator.

In the header files there are 2 sections, one which states that :


** No Commercial Usage
** This file contains pre-release code and may not be distributed.

and just below another one which says :


** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL

So, what? Can I use this project or not ? under LGPL or not ?

For now my application is not commercial, but if one day I want to use Qt Script Generator for a commercial app, will I be allowed to do so ?
Anybody here used Qt Script Generator in a commercial app ?

wysota
9th March 2011, 11:56
I think the text says it all.