PDA

View Full Version : How to implement "var rep = new Report("Report-1",9)" to QtScript?



sergey_85
17th November 2009, 20:59
Hi!

For example I have my own objects Report, Catalogue, Document, ...

//---------------------------------------------------------------------------------------------------------

class Report : public QObject
{
private:
QString name;
int id;

public:
Report(QString name, int id) { ... }
....

public slots:
bool execReport() {...}
QString getReportName() {...}

};

class Catalogue : public QObject
{ ... };

class Document : public QObject
{ ... };



Is it possible to use it in QtScript such as I write below:
//---------------------------------------------------------------------------------------------------------

//qt script lang
var rep = new Report("Report-1",1000);
var isOk = rep.execReport();

var cat = new Catalogue("Clients",true);
var cat = new Document("Doc-1");



Thank for help!