Hi, Stefan

We have some problems with declaration of singal inside of __init__ function.

1 - When you define the signal outside of __init__ function you are
declaring the signal in the current class TYPE. If you declare the
signal inside of __init__ function you are declaring the signal only
for current instance.

2 - Signals in Qt is registered on metaobject, and we have only one
metaobject for each type. Then you can't have individual signals/slot
for each instance.

3 - PySide register the signal/slot/properties on metaobject during
the QObject constructor, based on the class TYPE information, and if
everything works fine the object Signal is transfered to instance
object with all information necessary to connect/emit/get/set.

Because of that you can't declar the Signal, Slot, Property for
individual instance object.


BR
On Fri, Nov 5, 2010 at 1:34 PM, Stefan Krastanov
<[email protected]> wrote:
> Hi,
> I have the class SomeClass (a subclass of QWidget) and I want to define the
> signal someSignal.
> When I write this it's working
> class SomeClass(QtGui.QWidget):
>      def __init__(.....):
>           ......
>      someSignal = QtCore.Signal()
>
> But if I define the signal inside the init function it's not working:
> class SomeClass(QtGui.QWidget):
>      def __init__(.....):
>           ......
>           self.someSignal = QtCore.Signal()
> it gives AttributeError: 'PySide.QtCore.Signal' object has no attribute
> 'connect'
> Can someone explain to me that behavior (or just point me to the appropriate
> documentation as I have not found anything)
> Regards
> Stefan
> _______________________________________________
> PySide mailing list
> [email protected]
> http://lists.openbossa.org/listinfo/pyside
>
>



-- 
Renato Araujo Oliveira Filho
Instituto Nokia de Tecnologia - INdT
Mobile: +55 (81) 8704-2144
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to