[Kde-bindings] Duplicate methods for QByteArray::data()

Arno Rehn arno at arnorehn.de
Fri Nov 6 14:14:12 UTC 2009


On Friday 06 November 2009 04:32:23 Chris Burel wrote:
> I was trying out the new smokeqt object that's generated with Arno's
> new generator, and I discovered that there are 2 methods for
> QByteArray::data(), one that returns const data and one that doesn't.
> Is this by design?  I thought that the only methods that were
> considered ambiguous were ones that have the same name and number of
> arguments, but different types of arguments.  Should I change the
> ambiguous method resolution code in PerlQt4 to handle this case, or is
> it something that can be fixed in smoke?
> 
> grep QByteArray::data smokedata.cpp
>     {64, 7190, 0, 0, 0, 1692, 17},      //1927 QByteArray::data()
>     {64, 7190, 0, 0, Smoke::mf_const, 2113, 18},        //1928
> QByteArray::data() const
This is done on purpose. There are some use cases, especially in QtDBus, where 
you need the 'const' version of a method. Depending on whether the method is 
const or not the returned value differs. Most of the time it will suffice to 
simply call the non-const method, though.

-- 
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list