[PySide] manipulating >10 args?
matthew.woehlke at kitware.com
Tue Jul 23 18:45:56 CEST 2013
On 2013-07-23 07:01, Dennis Victorovich wrote:
> I'm not sure if its possible to pass more than 10 arguments into call.
> 10 arguments constraints may come from QMetaObject::Invoke() limitations (
> Take a look at cpp bindings code generated from your template. Shiboken may
> use QMetaObject::Invoke()
I'd expect it to be calling the code I gave it in <inject-code>:
%RETURN_TYPE retval_ =
%CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6,
%7, %8, %9, &ok_, %11);
...and it seems to be doing so:
double retval_ =
qtDoubleInputDialog::getDouble(cppArg0, cppArg1, cppArg2, cppArg3,
cppArg4, cppArg5, cppArg6, cppArg7,
cppArg8, &ok_, cppArg9);
(line re-wrapped for readability in e-mail)
There is no 'invoke' (case-insensitive search) anywhere in the generated
code for this class.
There may be cases where that is a real limit (FWIW I'll also point out
that this particular method is a static class method and - as such,
AFAIK - couldn't be called with QMetaObject::invokeMethod anyway), but
in general I would say shiboken ought to handle more than nine args. And
it seems the only problem is that the '%#' substitution doesn't check
for whole words (or operate from highest-number to lowest), such that
'%10', etc. ends up replaced as '%1' with a leftover digit.
So an easy and obvious fix is to ensure that '%1' is only replaced if it
is not followed by another digit, for which using a regex ending in '\b'
More information about the PySide