[PyKDE] pyqt and new-style classes
Stefan Seefeld
seefeld at sympatico.ca
Wed Feb 18 20:23:00 GMT 2004
Eron Lloyd wrote:
> Would there be any benefit in doing this? From the way I understand it, all Qt
> objects already expose their get/set methods, while any objects you create
> through subclassing can simply use Python's native properties support. For
> the most part, properties have their biggest value in use with Designer.
well, mostly syntactic sugar.
But I realize that qt often names the getter method the same way as the
property itself, which generates a naming conflict if you want to expose
both in python.
So the suggestion would have to be to *only* expose the property (and
escape the getter method name):
class QWidget(object):
def getCaption(self):
#...
def _caption(self): #escape with '_'
#...
caption = property(_caption, getCaption)
But as that would not be backward compatible I guess it's not an
option...
Regards,
Stefan
More information about the PyQt
mailing list