[Qt-interest] Changing public methods to public slots

Jean-Olivier Racine joracine at humancad.com
Tue Dec 29 15:53:01 CET 2009


One of the reason is when using QScript. Slots are accessible from 
scripts, non-slots aren't. Without this distinction, it would be painful 
to have classes for which all methods are not exposed to the scripts.

J-O

variadic.template wrote:
> Hi,
>
> I'm currently writing an application with QGraphicsView and all these  
> things, no problem
> there, in general. I have the need of calling some methods of  
> QGraphicsView through slots,
> like centerOn(...). So I'm going to derive from QGraphicsView and wrap the  
> methods
> I need and writing some slots for them - and that time the question "Why?"  
> hits in my face.
> I think that's something common and, at the same time, very annoying.  
> What's the reason
> for not-declaring all/most of the methods as slots? Of course, there will  
> be more things to do
> for the compiler (generating *_moc and compiling it), the libraries will  
> become bigger -
> but the developing itself could become more efficient. Did somebody  
> already try how big
> the libraries would be if all (public-) methods would be slots? Are there  
> any other
> reasons why this approach would be a bad idea?
>
> Hendrik
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>   




More information about the Qt-interest-old mailing list