[Qt-interest] QtScript: How to prevent default-constructed values calling methods from scripts with wrong types?
Wilhelm
wilhelm.meier at fh-kl.de
Thu Feb 10 15:44:28 CET 2011
Hi all,
this might be a dumb question but I can't find the right answer:
Assume the following class Test:
class Test : public QObject
{
...
Q_INVOKABLE Size foo(Size s);
...
};
which is exposed in a qtscript engine as variable "test".
The class Size is a value-type declared as a Qt-Metatype.
All works well if I call Test::foo(Size) with a Size-Object. But if
I call say foo("xxx"), the method gets called with a default-constructed
Size-value. That's at least confusing and not want I want. I would like
to have a runtime error here.
How can I achieve that?
--
Wilhelm
More information about the Qt-interest-old
mailing list