[Qt-interest] QtScript: TypeError: ambiguous call of overloaded function

Wilhelm wilhelm.meier at fh-kl.de
Sat Feb 12 20:56:59 CET 2011


Hi,

Am 12.02.2011 17:15, schrieb Rohan Prabhu:
> This is not an error regarding QtScript at all. It's a pure C++ error
> you are facing. Please mention your function definitions or atleast
> the declaration of the two different click functions. Such an error is
> common if the overloaded functions of type are:
> 
> click(int x, int c = 0)
> click(int y, void* x = 0)
> 
> in that case, something like:
> 
> click(8)
> 
> would result in that error since the compiler is not able to figure
> out which function to call since both the function signatures comply
> with the parameters you are calling it with. Now I am not sure what
> the error is in your case, since the very first parameter is enough to
> disambiguate between the two overloaded functions. So, in that case,
> please do mention how your functions are declared.
> 
> Another reason this might be happening is in the case when parameters
> are convertible. For example, the pow function is available in two
> functions:
> 
> pow(long double, long double)
> pow(float, float)
> 
> hence, if you call something like:
> 
> pow(int, int)
> 
> the compiler is not able to determine whether the int should be
> overloaded to a float or a long double and call which function. In
> your case unless you are calling the function with some object which
> is convertible to both Match and QList<Match> then such an error is
> possible. 

no implicit type conversion here!

> So please do mention the declaration 

see the OP

of the functions, we
> can determine better what the problem could be.

a full example is included in this mail as attachement.

> 
> Regards,
> rohan
> 
> On Fri, Feb 11, 2011 at 12:03 PM, Wilhelm <wilhelm.meier at fh-kl.de> wrote:
>> Hi all,
>>
>> I have a QObject exposing the two overloaded methods click() (see below)
>> to the QtScript engine. If I want to call them with an argument of type
>> Match I get the following:
>>
>> "TypeError: ambiguous call of overloaded function click(); candidates were
>>    click(Match)
>>    click(QList<Match>)"
>>
>> What's wrong here?
>>
>> --
>> Wilhelm
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at qt.nokia.com
>> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>>


-- 
Wilhelm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.h
Type: text/x-chdr
Size: 482 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110212/12a078e4/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.cc
Type: text/x-c++src
Size: 508 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110212/12a078e4/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: size.h
Type: text/x-chdr
Size: 692 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110212/12a078e4/attachment-0002.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: size.cc
Type: text/x-c++src
Size: 738 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110212/12a078e4/attachment-0003.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cc
Type: text/x-c++src
Size: 2880 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110212/12a078e4/attachment-0004.bin 


More information about the Qt-interest-old mailing list