[PyQt] Problem with latest sip causing wrong function to be called(QVariant related)

Phil Thompson phil at riverbankcomputing.com
Tue Nov 3 18:30:59 GMT 2009


On Tue, 3 Nov 2009 10:53:32 -0700, Matt Newell <newellm at blur.com> wrote:
> I have these two functions in a class. Same definition in both the .h and

> the .sip file.
> 
> 	MappedRecordList filter( const QString & column, const QVariant & value,
> 	bool
> keepMatches = true ) const;
> 
> 	MappedRecordList filter( const QString & column, const QRegExp & re,
bool 
> keepMatches = true ) const;
> 
> 
> Called as
> 
> .filter('service',QRegExp('^Fusion'))
> 
> before it would call the second function as expected, now it is calling
the
> 
> first.  I'm not sure when this behavior started.  I am using sip 4.9.1.
> 
> I can write a test case if needed but i'm guessing you'll understand the
> issue 
> without one.

Any Python object can now be converted to a QVariant so a QRegExp can be
handled by the first overload.

Either add /Constrained/ to the QVariant argument or swap the two overloads
around.

Phil


More information about the PyQt mailing list