[PyQt] Proposal for New-style Signals

nytmyn nytmyn at gmail.com
Wed Jan 30 21:12:23 GMT 2008




> On Wednesday 30 January 2008, nytmyn wrote:
>> The stage 2 simplified qt signals looks just great :)
>> What about signals declared in Python? I'd really like to have
>> the possibility to declare and use them as the qt ones.
> 
> You can do that now using __pyqtSignals__.
> 

I know I can use __pyqtSignals__ . Maybe I missed something about it, but I
think it can't provide similar syntax as you proposed for qt signals. I mean
things like object.signalFoo.connect(..) and similar. And I find having
different syntaxes for qt and python signals/slots inconvenient. (I know I
can use old, consistent, string based syntax). There are qt signals, python
signals, shortcut signals, c++ signatures declarations, __pyqtSignals etc.
In my opinion signals in PyQt are unnecessarily complicated for newcomers.



>> All QObjects derrived classes are passed as pointers and
>> the values based classes are (really) often passed as const references
>> so signatures of python declared signals and slots could be formed from
>> python types and use
>> c++ string based declarations only for more complicated cases.
>> I admit I really love C++ but I hate seeing it in Python :)
>>
>> class Example(QObject):
>>   signalFoo = Signal(int)
>>
>>   @pyqtSignature("newSlotName", int, QImage)
>>   def slotBar(self, number, image):
>>     pass
> 
> Strings are going to stay for the reasons I've already given.
> 
> 

I don't wanna have strings removed, I just thought using python types would
be enough for Qt and it could help people not used to c++ and would mean
less typing, less error/typos prone code, code completion etc. for others
and wouldn't hurt string lovers :) Of course I can use wrappers on top of
slot decorator and signal declaration if I'm the only one interested :).



> 
> Phil
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> 
> 

Jakub

-- 
View this message in context: http://www.nabble.com/Proposal-for-New-style-Signals-tp14999834p15192178.html
Sent from the PyQt mailing list archive at Nabble.com.



More information about the PyQt mailing list