Re: [PyQt] Overriding only one of two C++ virtual methods with different signature

2008-01-20 Thread Adeodato Simó
* Phil Thompson [Sat, 19 Jan 2008 19:21:10 +]:

 You need to handle both cases. Check the type of the argument to determine 
 which one is called. For the one you aren't interested in, just call the base 
 implementation...

     def updateSearch(self, arg):
         if not isinstance(arg, QString):
             superclass.updateSearch(self, arg):
         else:
             do_your_thing()

OK, this is exactly what I was doing, but wanted to know if there was
another way.

Thank you,

-- 
Adeodato Simó dato at net.com.org.es
Debian Developer  adeodato at debian.org
 
 Listening to: Joaquín Sabina - Con lo que eso duele

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Overriding only one of two C++ virtual methods with different signature

2008-01-19 Thread Adeodato Simó
Hello.

I've subclassed in Python from a C++ class that has:

  public slots:

virtual void updateSearch (const QString pattern=QString());

  protected:

virtual void updateSearch (QTreeWidget *treeWidget);

I want to provide my own updateSearch(), but only for the slot case. Is
this possible at all? At the moment, my python function is gettin called
in both cases.

Any help appreciated.

-- 
Adeodato Simó dato at net.com.org.es
Debian Developer  adeodato at debian.org
 
And how do you tell an extroverted mathematician? He looks at *your* shoes
while he's talking to you.

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Overriding only one of two C++ virtual methods with different signature

2008-01-19 Thread Phil Thompson
On Saturday 19 January 2008, Adeodato Simó wrote:
 Hello.

 I've subclassed in Python from a C++ class that has:

   public slots:

 virtual void updateSearch (const QString pattern=QString());

   protected:

 virtual void updateSearch (QTreeWidget *treeWidget);

 I want to provide my own updateSearch(), but only for the slot case. Is
 this possible at all? At the moment, my python function is gettin called
 in both cases.

 Any help appreciated.

You need to handle both cases. Check the type of the argument to determine 
which one is called. For the one you aren't interested in, just call the base 
implementation...

    def updateSearch(self, arg):
        if not isinstance(arg, QString):
            superclass.updateSearch(self, arg):
        else:
            do_your_thing()

Phil

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt