Qtscript - docs and facts
The documentation says that only properties, signals and slots of QObject are accessible from QtScript.
I was going to write a wrappers around QSqlDatabase and some other classes to make their methods available within QtScript, but many examples (like "this":http://web.archiveorange.com/archive/v/GOQxSicQAGgaqKmnj94B or "this":http://filonenko-mikhail.blogspot.ru/2010/06/pgsql.html) shows that just a public methods are available. I've checked qt sources for addDatabase(), open(), exec(), prepare() and other methods. What does it mean?
i don't think that they have to be public.
The Qt Meta Object system has to find them and calls them.
Thus you should either declare them as slots or with Q_INVOKEABLE.
(Don't forget the Q_OBJECT macro in your class definition).
That's why they have to be QObject derivatives btw. ;)
I understand Q_INVOKEABLE and so on. But I don't see neither Q_INVOKEABLE, nor slots declaration in qsqldatabase.h and qsqlquery.h.
Do I miss something?
they just aren't meant to be used this way, thus they don't have such declarations...
You will need to write a wrapper class which forwards the calls to the actual object. Depending on your needs this may impossible or just awkward work ;)
It looks like I'am confused by effect of QtScript Bindings Generator. It's clear now.
raven-worx, thanks for your help!