[Qt-interest] emitting signal from another class

John McClurkin jwm at nei.nih.gov
Thu Jul 15 14:05:26 CEST 2010


Sajjad wrote:
> Hello forum,
> 
> I have a singleton class whose data are shared between different other 
> classes. The Shared class has some signals defined.
> 
> I am getting the following error when i try to emit sigal of the shared 
> class from another class:
> 
> 
> 
> ***********************************
> 
> /home/studenter/sajis997/QtStuff/transformation/SharedWidgetData.h:79: 
> error: ‘void SharedWidgetData::modelViewMatrixChanged()’ is protected
> 
> 
> 
> ***********************************
> 
> 
> the code that generated the error is follows:
> 
> 
> ******************************************
> 
> .....
> .....
> emit pSharedData->modelViewMatrixChanged();
> ......
> ......
> 
> ******************************************
> 
> It seems that the signals are by default protected. Is that so or i am 
> getting it somewhere wrong.
> 

You are getting it wrong. Signals can be public, protected, or private, 
just like any other class member. In your case you need to declare the 
signal public.



More information about the Qt-interest-old mailing list